Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
podlesny
dune-tectonic
Commits
dffa270a
Commit
dffa270a
authored
10 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
[Cleanup] Move specialWriter to separate header
parent
8f34386f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sand-wedge-data/special_writer.hh
+84
-0
84 additions, 0 deletions
src/sand-wedge-data/special_writer.hh
src/sand-wedge.cc
+5
-76
5 additions, 76 deletions
src/sand-wedge.cc
with
89 additions
and
76 deletions
src/sand-wedge-data/special_writer.hh
0 → 100644
+
84
−
0
View file @
dffa270a
#ifndef SPECIAL_WRITER_HH
#define SPECIAL_WRITER_HH
#include
<fstream>
#include
<utility>
#include
<dune/common/fvector.hh>
#include
<dune/grid/utility/hierarchicsearch.hh>
#include
"mygeometry.hh"
template
<
class
GridView
,
int
dimension
>
class
SpecialWriter
{
using
LocalVector
=
Dune
::
FieldVector
<
double
,
dimension
>
;
using
Element
=
typename
GridView
::
Grid
::
template
Codim
<
0
>
::
Entity
;
using
ElementPointer
=
typename
GridView
::
Grid
::
template
Codim
<
0
>
::
EntityPointer
;
void
writeHorizontal
(
LocalVector
const
&
v
)
{
writer_
<<
MyGeometry
::
horizontalProjection
(
v
)
<<
" "
;
}
void
writeVertical
(
LocalVector
const
&
v
)
{
writer_
<<
MyGeometry
::
verticalProjection
(
v
)
<<
" "
;
}
std
::
pair
<
ElementPointer
,
LocalVector
>
globalToLocal
(
LocalVector
const
&
x
)
const
{
auto
const
element
=
hsearch_
.
findEntity
(
x
);
return
std
::
pair
<
ElementPointer
,
LocalVector
>
(
element
,
element
->
geometry
().
local
(
x
));
}
std
::
fstream
writer_
;
Dune
::
HierarchicSearch
<
typename
GridView
::
Grid
,
GridView
>
const
hsearch_
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
G
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
H
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
J
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
I
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
U
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
Z
;
public
:
SpecialWriter
(
std
::
string
filename
,
GridView
const
&
gridView
)
:
writer_
(
filename
,
std
::
fstream
::
out
),
hsearch_
(
gridView
.
grid
(),
gridView
),
G
(
globalToLocal
(
MyGeometry
::
G
)),
H
(
globalToLocal
(
MyGeometry
::
H
)),
J
(
globalToLocal
(
MyGeometry
::
J
)),
I
(
globalToLocal
(
MyGeometry
::
I
)),
U
(
globalToLocal
(
MyGeometry
::
U
)),
Z
(
globalToLocal
(
MyGeometry
::
Z
))
{
writer_
<<
"Gh Hh Jh Ih Uv Uh Zv Zh"
<<
std
::
endl
;
}
void
write
(
VirtualGridFunction
<
typename
GridView
::
Grid
,
LocalVector
>
const
&
specialField
)
{
LocalVector
value
;
specialField
.
evaluateLocal
(
*
G
.
first
,
G
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
H
.
first
,
H
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
J
.
first
,
J
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
I
.
first
,
I
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
U
.
first
,
U
.
second
,
value
);
writeVertical
(
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
Z
.
first
,
Z
.
second
,
value
);
writeVertical
(
value
);
writeHorizontal
(
value
);
writer_
<<
std
::
endl
;
}
};
#endif
This diff is collapsed.
Click to expand it.
src/sand-wedge.cc
+
5
−
76
View file @
dffa270a
...
@@ -80,6 +80,7 @@
...
@@ -80,6 +80,7 @@
#include
"sand-wedge-data/myglobalfrictiondata.hh"
#include
"sand-wedge-data/myglobalfrictiondata.hh"
#include
"sand-wedge-data/mygrid.cc"
// FIXME
#include
"sand-wedge-data/mygrid.cc"
// FIXME
#include
"sand-wedge-data/mygrid.hh"
#include
"sand-wedge-data/mygrid.hh"
#include
"sand-wedge-data/special_writer.hh"
#include
"solverfactory.hh"
#include
"solverfactory.hh"
#include
"state.hh"
#include
"state.hh"
#include
"timestepping.hh"
#include
"timestepping.hh"
...
@@ -94,78 +95,6 @@ void initPython() {
...
@@ -94,78 +95,6 @@ void initPython() {
Python
::
run
(
"sys.path.append('"
datadir
"')"
);
Python
::
run
(
"sys.path.append('"
datadir
"')"
);
}
}
template
<
class
GridView
>
class
SpecialWriter
{
using
LocalVector
=
Dune
::
FieldVector
<
double
,
dims
>
;
using
Element
=
typename
GridView
::
Grid
::
template
Codim
<
0
>
::
Entity
;
using
ElementPointer
=
typename
GridView
::
Grid
::
template
Codim
<
0
>
::
EntityPointer
;
void
writeHorizontal
(
LocalVector
const
&
v
)
{
writer_
<<
MyGeometry
::
horizontalProjection
(
v
)
<<
" "
;
}
void
writeVertical
(
LocalVector
const
&
v
)
{
writer_
<<
MyGeometry
::
verticalProjection
(
v
)
<<
" "
;
}
std
::
pair
<
ElementPointer
,
LocalVector
>
globalToLocal
(
LocalVector
const
&
x
)
const
{
auto
const
element
=
hsearch_
.
findEntity
(
x
);
return
std
::
pair
<
ElementPointer
,
LocalVector
>
(
element
,
element
->
geometry
().
local
(
x
));
}
std
::
fstream
writer_
;
Dune
::
HierarchicSearch
<
typename
GridView
::
Grid
,
GridView
>
const
hsearch_
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
G
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
H
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
J
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
I
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
U
;
std
::
pair
<
ElementPointer
,
LocalVector
>
const
Z
;
public
:
SpecialWriter
(
std
::
string
filename
,
GridView
const
&
gridView
)
:
writer_
(
filename
,
std
::
fstream
::
out
),
hsearch_
(
gridView
.
grid
(),
gridView
),
G
(
globalToLocal
(
MyGeometry
::
G
)),
H
(
globalToLocal
(
MyGeometry
::
H
)),
J
(
globalToLocal
(
MyGeometry
::
J
)),
I
(
globalToLocal
(
MyGeometry
::
I
)),
U
(
globalToLocal
(
MyGeometry
::
U
)),
Z
(
globalToLocal
(
MyGeometry
::
Z
))
{
writer_
<<
"Gh Hh Jh Ih Uv Uh Zv Zh"
<<
std
::
endl
;
}
void
write
(
VirtualGridFunction
<
typename
GridView
::
Grid
,
LocalVector
>
const
&
specialField
)
{
LocalVector
value
;
specialField
.
evaluateLocal
(
*
G
.
first
,
G
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
H
.
first
,
H
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
J
.
first
,
J
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
I
.
first
,
I
.
second
,
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
U
.
first
,
U
.
second
,
value
);
writeVertical
(
value
);
writeHorizontal
(
value
);
specialField
.
evaluateLocal
(
*
Z
.
first
,
Z
.
second
,
value
);
writeVertical
(
value
);
writeHorizontal
(
value
);
writer_
<<
std
::
endl
;
}
};
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
try
{
try
{
Dune
::
ParameterTree
parset
;
Dune
::
ParameterTree
parset
;
...
@@ -387,10 +316,10 @@ int main(int argc, char *argv[]) {
...
@@ -387,10 +316,10 @@ int main(int argc, char *argv[]) {
vtkWriter
.
write
(
0
,
u_initial
,
v_initial
,
alpha_initial
,
stress
);
vtkWriter
.
write
(
0
,
u_initial
,
v_initial
,
alpha_initial
,
stress
);
}
}
SpecialWriter
<
GridView
>
specialVelocityWriter
(
"specialVelocities"
,
SpecialWriter
<
GridView
,
dims
>
specialVelocityWriter
(
"specialVelocities"
,
leafView
);
leafView
);
SpecialWriter
<
GridView
>
specialDisplacementWriter
(
"specialDisplacements"
,
SpecialWriter
<
GridView
,
dims
>
specialDisplacementWriter
(
leafView
);
"specialDisplacements"
,
leafView
);
// Set up TNNMG solver
// Set up TNNMG solver
using
NonlinearFactory
=
using
NonlinearFactory
=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment