Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Core Modules
dune-common
Commits
70ae9d15
Commit
70ae9d15
authored
20 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
adapted to new function spaces, writeBlockVector also writes data for hexahedral grids
[[Imported from SVN: r1215]]
parent
563af9e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io/file/amiramesh/amirameshwriter.cc
+43
-12
43 additions, 12 deletions
io/file/amiramesh/amirameshwriter.cc
with
43 additions
and
12 deletions
io/file/amiramesh/amirameshwriter.cc
+
43
−
12
View file @
70ae9d15
...
...
@@ -304,13 +304,7 @@ template<class DiscFuncType>
void
Dune
::
AmiraMeshWriter
<
GridType
>::
writeFunction
(
const
DiscFuncType
&
f
,
const
std
::
string
&
filename
)
{
// Get grid type associated with DiscFuncType
typedef
typename
DiscFuncType
::
FunctionSpaceType
FunctionSpaceType
;
const
GridType
&
grid
=
f
.
getFunctionSpace
().
getGrid
();
const
int
level
=
grid
.
maxlevel
();
const
int
noOfNodes
=
grid
.
size
(
level
,
GridType
::
dimension
);
const
int
noOfNodes
=
f
.
getFunctionSpace
().
size
();
// temporary hack
const
int
ncomp
=
1
;
...
...
@@ -335,8 +329,8 @@ void Dune::AmiraMeshWriter<GridType>::writeFunction(const DiscFuncType& f,
// write the data into the AmiraMesh object
typedef
typename
DiscFuncType
::
DofIteratorType
DofIterator
;
DofIterator
dit
=
f
.
dbegin
(
level
);
DofIterator
ditend
=
f
.
dend
(
level
);
DofIterator
dit
=
f
.
dbegin
();
DofIterator
ditend
=
f
.
dend
();
int
i
=
0
;
for
(;
dit
!=
ditend
;
++
dit
,
i
++
)
{
...
...
@@ -356,11 +350,31 @@ void Dune::AmiraMeshWriter<GridType>::writeFunction(const DiscFuncType& f,
template
<
class
GridType
>
void
Dune
::
AmiraMeshWriter
<
GridType
>::
writeBlockVector
(
const
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
3
>
>&
f
,
void
Dune
::
AmiraMeshWriter
<
GridType
>::
writeBlockVector
(
const
GridType
&
grid
,
const
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
3
>
>&
f
,
const
std
::
string
&
filename
)
{
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
3
>
>
VectorType
;
int
level
=
grid
.
maxlevel
();
// Find out whether the grid contains only tetrahedra. If yes, then
// it is written in TetraGrid format. If not, it is written in
// hexagrid format.
bool
containsOnlyTetrahedra
=
true
;
typename
GridType
::
template
Traits
<
0
>
::
LevelIterator
element
=
grid
.
template
lbegin
<
0
>(
level
);
typename
GridType
::
template
Traits
<
0
>
::
LevelIterator
end
=
grid
.
template
lend
<
0
>(
level
);
for
(;
element
!=
end
;
++
element
)
{
if
(
element
->
geometry
().
type
()
!=
tetrahedron
)
{
containsOnlyTetrahedra
=
false
;
break
;
}
}
// Get number of components
/** \todo Must depend on the BlockVector and not on the grid! */
const
int
ncomp
=
GridType
::
dimension
;
...
...
@@ -372,14 +386,31 @@ void Dune::AmiraMeshWriter<GridType>::writeBlockVector(const Dune::BlockVector<D
if
(
GridType
::
dimension
==
2
)
am
.
parameters
.
set
(
"ContentType"
,
"HxTriangularData"
);
if
(
!
containsOnlyTetrahedra
)
{
int
numElements
=
grid
.
size
(
level
,
0
);
AmiraMesh
::
Location
*
hexa_loc
=
new
AmiraMesh
::
Location
(
"Hexahedra"
,
numElements
);
am
.
insert
(
hexa_loc
);
}
AmiraMesh
::
Location
*
sol_nodes
=
new
AmiraMesh
::
Location
(
"Nodes"
,
f
.
size
());
am
.
insert
(
sol_nodes
);
AmiraMesh
::
Data
*
nodeData
=
new
AmiraMesh
::
Data
(
"Data"
,
sol_nodes
,
McPrimType
::
mc_double
,
ncomp
);
am
.
insert
(
nodeData
);
AmiraMesh
::
Field
*
nodeField
=
new
AmiraMesh
::
Field
(
"sol"
,
ncomp
,
McPrimType
::
mc_double
,
AmiraMesh
::
t_linear
,
nodeData
);
AmiraMesh
::
Field
*
nodeField
;
if
(
containsOnlyTetrahedra
)
{
nodeField
=
new
AmiraMesh
::
Field
(
"sol"
,
ncomp
,
McPrimType
::
mc_double
,
AmiraMesh
::
t_linear
,
nodeData
);
}
else
{
nodeField
=
new
AmiraMesh
::
Field
(
"sol"
,
ncomp
,
McPrimType
::
mc_double
,
AmiraMesh
::
t_trilinear
,
nodeData
);
}
am
.
insert
(
nodeField
);
...
...
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