Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amdis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aland, Sebastian
amdis
Commits
7db0b6df
Commit
7db0b6df
authored
Nov 06, 2012
by
Thomas Witkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work on ARH read and writer.
parent
edc55c09
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
5 deletions
+133
-5
AMDiS/src/Debug.cc
AMDiS/src/Debug.cc
+18
-0
AMDiS/src/Debug.h
AMDiS/src/Debug.h
+10
-0
AMDiS/src/io/ArhReader.cc
AMDiS/src/io/ArhReader.cc
+91
-2
AMDiS/src/io/ArhReader.h
AMDiS/src/io/ArhReader.h
+14
-2
AMDiS/src/io/ArhWriter.cc
AMDiS/src/io/ArhWriter.cc
+0
-1
No files found.
AMDiS/src/Debug.cc
View file @
7db0b6df
...
...
@@ -111,6 +111,24 @@ namespace AMDiS {
}
void
writeMacroElementIndexMesh
(
Mesh
*
mesh
,
std
::
string
filename
)
{
std
::
map
<
int
,
double
>
vec
;
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
);
while
(
elInfo
)
{
int
index
=
elInfo
->
getElement
()
->
getIndex
();
int
macroIndex
=
elInfo
->
getMacroElement
()
->
getIndex
();
vec
[
index
]
=
macroIndex
;
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
ElementFileWriter
::
writeFile
(
vec
,
mesh
,
filename
,
".vtu"
);
}
void
highlightElementIndexMesh
(
Mesh
*
mesh
,
int
idx
,
std
::
string
filename
)
{
std
::
map
<
int
,
double
>
vec
;
...
...
AMDiS/src/Debug.h
View file @
7db0b6df
...
...
@@ -93,6 +93,16 @@ namespace AMDiS {
std
::
string
filename
,
int
level
=
-
1
);
/** \brief
* Creates a vtu file where all elements in the mesh are colored by the
* macro element indices.
*
* \param[in] feSpace The FE space to be used.
* \param[in] filename Name of the file.
*/
void
writeMacroElementIndexMesh
(
Mesh
*
mesh
,
std
::
string
filename
);
void
highlightElementIndexMesh
(
Mesh
*
mesh
,
int
idx
,
std
::
string
filename
);
void
colorMeshByMacroIndex
(
Mesh
*
mesh
,
std
::
string
filename
);
...
...
AMDiS/src/io/ArhReader.cc
View file @
7db0b6df
...
...
@@ -12,12 +12,14 @@
#include <fstream>
#include <stdint.h>
#include <boost/filesystem.hpp>
#include "ArhReader.h"
#include "Mesh.h"
#include "MeshStructure.h"
#include "Traverse.h"
#include "DOFVector.h"
#include "Debug.h"
namespace
AMDiS
{
...
...
@@ -76,6 +78,85 @@ namespace AMDiS {
}
void
ArhReader
::
readMeta
(
string
filename
,
Mesh
*
mesh
,
DOFVector
<
double
>*
vec0
,
DOFVector
<
double
>*
vec1
,
DOFVector
<
double
>*
vec2
)
{
vector
<
DOFVector
<
double
>*>
vecs
;
if
(
vec0
)
vecs
.
push_back
(
vec0
);
if
(
vec1
)
vecs
.
push_back
(
vec1
);
if
(
vec2
)
vecs
.
push_back
(
vec2
);
readMeta
(
filename
,
mesh
,
vecs
);
}
void
ArhReader
::
readMeta
(
string
filename
,
Mesh
*
mesh
,
vector
<
DOFVector
<
double
>*>
vecs
)
{
FUNCNAME
(
"ArhReader::readMeta()"
);
boost
::
filesystem
::
path
p
(
filename
.
c_str
());
boost
::
filesystem
::
path
directory
=
p
.
parent_path
();
ifstream
file
;
file
.
open
(
filename
.
c_str
());
TEST_EXIT
(
file
.
is_open
())
(
"Cannot open arh meta file
\"
%s
\"\n
"
,
filename
.
c_str
());
string
readStr
=
""
;
file
>>
readStr
;
string
arhPrefix
=
""
;
file
>>
arhPrefix
;
int
nProc
;
file
>>
nProc
;
// Maps to each macro element index the arh file index it is stored in.
map
<
int
,
int
>
macroInProc
;
for
(
int
i
=
0
;
i
<
nProc
;
i
++
)
{
int
tmp
;
file
>>
tmp
;
TEST_EXIT
(
tmp
==
i
)(
"Should not happen!
\n
"
);
int
nMacroEl
;
file
>>
nMacroEl
;
for
(
int
j
=
0
;
j
<
nMacroEl
;
j
++
)
{
int
elIndex
;
file
>>
elIndex
;
macroInProc
[
elIndex
]
=
i
;
}
}
file
.
close
();
// Set of all file indices which should be read to restore all macro elements.
std
::
set
<
int
>
readArhFiles
;
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
0
,
Mesh
::
CALL_EL_LEVEL
);
while
(
elInfo
)
{
int
macroElIndex
=
elInfo
->
getElement
()
->
getIndex
();
TEST_EXIT
(
macroInProc
.
count
(
macroElIndex
))(
"Should not happen!
\n
"
);
readArhFiles
.
insert
(
macroInProc
[
macroElIndex
]);
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
for
(
std
::
set
<
int
>::
iterator
it
=
readArhFiles
.
begin
();
it
!=
readArhFiles
.
end
();
++
it
)
{
string
arhFilename
=
directory
.
native
()
+
"/"
+
arhPrefix
+
"-p"
+
boost
::
lexical_cast
<
string
>
(
*
it
)
+
"-.arh"
;
MSG
(
"READ FILE: %s
\n
"
,
arhFilename
.
c_str
());
readFile
(
arhFilename
,
mesh
,
vecs
);
}
}
void
ArhReader
::
readFile
(
string
filename
,
Mesh
*
mesh
,
vector
<
DOFVector
<
double
>*>
vecs
)
...
...
@@ -135,8 +216,16 @@ namespace AMDiS {
MeshStructure
elementStructure
;
elementStructure
.
init
(
structureCode
,
codeSize
);
if
(
macroInMesh
.
count
(
elIndex
)
==
1
)
if
(
macroInMesh
.
count
(
elIndex
))
{
MSG
(
"READ MACRO EL %d
\n
"
,
elIndex
);
if
(
MPI
::
COMM_WORLD
.
Get_rank
()
==
52
&&
elIndex
==
19777
)
{
debug
::
writeMacroElementIndexMesh
(
mesh
,
"test"
);
}
elementStructure
.
fitMeshToStructure
(
mesh
,
refManager
,
false
,
elIndex
);
}
if
(
nValueVectors
>
0
)
{
uint32_t
nValuesPerVector
=
0
;
...
...
@@ -146,7 +235,7 @@ namespace AMDiS {
vector
<
double
>
values
(
nValuesPerVector
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
(
values
[
0
])),
8
*
nValuesPerVector
);
if
(
vecs
[
j
]
!=
NULL
)
{
if
(
macroInMesh
.
count
(
elIndex
)
==
1
)
if
(
macroInMesh
.
count
(
elIndex
))
setDofValues
(
elIndex
,
mesh
,
values
,
vecs
[
j
]);
}
}
...
...
AMDiS/src/io/ArhReader.h
View file @
7db0b6df
...
...
@@ -32,7 +32,8 @@ namespace AMDiS {
class
ArhReader
{
public:
static
void
read
(
string
filename
,
Mesh
*
mesh
,
static
void
read
(
string
filename
,
Mesh
*
mesh
,
DOFVector
<
double
>*
vec0
=
NULL
,
DOFVector
<
double
>*
vec1
=
NULL
,
DOFVector
<
double
>*
vec2
=
NULL
,
...
...
@@ -43,7 +44,8 @@ namespace AMDiS {
#endif
int
nProcs
=
-
1
);
static
void
read
(
string
filename
,
Mesh
*
mesh
,
static
void
read
(
string
filename
,
Mesh
*
mesh
,
vector
<
DOFVector
<
double
>*>
vecs
,
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
bool
writeParallel
=
true
,
...
...
@@ -52,6 +54,16 @@ namespace AMDiS {
#endif
int
nProcs
=
-
1
);
static
void
readMeta
(
string
filename
,
Mesh
*
mesh
,
DOFVector
<
double
>*
vec0
=
NULL
,
DOFVector
<
double
>*
vec1
=
NULL
,
DOFVector
<
double
>*
vec2
=
NULL
);
static
void
readMeta
(
string
filename
,
Mesh
*
mesh
,
vector
<
DOFVector
<
double
>*>
vecs
);
static
void
readFromMemoryBlock
(
vector
<
char
>
&
data
,
Mesh
*
mesh
,
DOFVector
<
double
>*
vec0
=
NULL
,
DOFVector
<
double
>*
vec1
=
NULL
,
...
...
AMDiS/src/io/ArhWriter.cc
View file @
7db0b6df
...
...
@@ -131,7 +131,6 @@ namespace AMDiS {
{
FUNCNAME
(
"ArhWriter::writeMacroElement()"
);
MSG
(
"WRITE INDEX: %d
\n
"
,
elIndex
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
elIndex
),
4
);
uint32_t
nStructureCodes
=
code
.
getCode
().
size
();
...
...
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