Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
6fe8f1ec
Commit
6fe8f1ec
authored
Jul 06, 2010
by
Thomas Witkowski
Browse files
Added hierarchical mesh writer based on mesh structure codes.
parent
bc21bb8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/MeshStructure.cc
View file @
6fe8f1ec
...
...
@@ -299,4 +299,58 @@ namespace AMDiS {
{
return
(
other
.
getCode
()
==
code
);
}
void
MeshStructure
::
writeMeshFile
(
Mesh
*
mesh
,
std
::
string
filename
)
{
FUNCNAME
(
"MeshStructure::writeMeshFile()"
);
int
nMacroElements
=
0
;
int
macroElIndex
=
-
1
;
std
::
ofstream
file
;
file
.
open
(
filename
.
c_str
(),
std
::
ios
::
out
|
std
::
ios
::
binary
|
std
::
ios
::
trunc
);
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
0
,
Mesh
::
CALL_EL_LEVEL
);
while
(
elInfo
)
{
nMacroElements
++
;
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
file
<<
nMacroElements
;
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_EVERY_EL_PREORDER
);
while
(
elInfo
)
{
if
(
elInfo
->
getLevel
()
==
0
)
{
if
(
macroElIndex
!=
-
1
)
{
commit
();
writeMacroElement
(
file
,
macroElIndex
);
}
clear
();
macroElIndex
=
elInfo
->
getElement
()
->
getIndex
();
}
insertElement
(
elInfo
->
getElement
()
->
isLeaf
());
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
// And write the last macro element to file.
TEST_EXIT_DBG
(
macroElIndex
!=
-
1
)(
"Should not happen!
\n
"
);
commit
();
writeMacroElement
(
file
,
macroElIndex
);
file
.
close
();
}
void
MeshStructure
::
writeMacroElement
(
std
::
ofstream
&
file
,
int
macroElIndex
)
{
file
<<
macroElIndex
;
file
<<
nElements
;
file
<<
code
.
size
();
for
(
unsigned
int
i
=
0
;
i
<
code
.
size
();
i
++
)
file
<<
code
[
i
];
}
}
AMDiS/src/MeshStructure.h
View file @
6fe8f1ec
...
...
@@ -156,6 +156,8 @@ namespace AMDiS {
/// Returns true, if the given mesh structure code is equal to this one.
bool
compare
(
MeshStructure
&
other
);
void
writeMeshFile
(
Mesh
*
mesh
,
std
::
string
filename
);
protected:
/// Insert a new element to the structure code. Is used by the init function.
void
insertElement
(
bool
isLeaf
);
...
...
@@ -167,6 +169,8 @@ namespace AMDiS {
MeshStructure
*
structure2
,
MeshStructure
*
result
);
void
writeMacroElement
(
std
::
ofstream
&
file
,
int
macroElIndex
);
protected:
/// Mesh structure code.
std
::
vector
<
unsigned
long
int
>
code
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment