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
Backofen, Rainer
amdis
Commits
42860170
Commit
42860170
authored
Apr 21, 2011
by
Thomas Witkowski
Browse files
And make parallel compilation running.
parent
c3eaaa42
Changes
10
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/Mesh.cc
View file @
42860170
...
...
@@ -1393,7 +1393,9 @@ namespace AMDiS {
stringstream
oss
;
oss
<<
globalRefinements
;
ADD_PARAMETER
(
0
,
name
+
"->global refinements"
,
oss
.
str
().
c_str
());
Parameters
::
addGlobalParameter
(
0
,
name
+
"->global refinements"
,
oss
.
str
().
c_str
());
// === Print a note to the screen that another mesh file will be used. ===
...
...
AMDiS/src/ProblemInstat.cc
View file @
42860170
...
...
@@ -21,6 +21,8 @@
#include "io/FileWriter.h"
namespace
AMDiS
{
using
namespace
std
;
void
ProblemInstatBase
::
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
...
...
@@ -54,23 +56,26 @@ namespace AMDiS {
}
ProblemInstat
::
ProblemInstat
(
std
::
string
sname
,
ProblemStat
*
prob
,
ProblemStatBase
*
initialProb
)
ProblemInstat
::
ProblemInstat
(
string
sname
,
ProblemStatSeq
*
prob
,
ProblemStatBase
*
initialProb
)
:
ProblemInstatBase
(
sname
,
initialProb
),
problemStat
(
prob
),
oldSolution
(
NULL
)
{}
ProblemInstat
::
ProblemInstat
(
std
::
string
sname
,
ProblemStat
&
prob
)
ProblemInstat
::
ProblemInstat
(
string
sname
,
ProblemStatSeq
&
prob
)
:
ProblemInstatBase
(
sname
,
NULL
),
problemStat
(
&
prob
),
oldSolution
(
NULL
)
{}
ProblemInstat
::
ProblemInstat
(
std
::
string
sname
,
ProblemStat
&
prob
,
ProblemStatBase
&
initialProb
)
ProblemInstat
::
ProblemInstat
(
string
sname
,
ProblemStatSeq
&
prob
,
ProblemStatBase
&
initialProb
)
:
ProblemInstatBase
(
sname
,
&
initialProb
),
problemStat
(
&
prob
),
oldSolution
(
NULL
)
...
...
AMDiS/src/ProblemInstat.h
View file @
42860170
...
...
@@ -148,12 +148,12 @@ namespace AMDiS {
public:
/// Constructs a ProblemInstatVec with prob as its stationary problem.
ProblemInstat
(
std
::
string
name
,
ProblemStat
*
prob
,
ProblemStat
Seq
*
prob
,
ProblemStatBase
*
initialProb
=
NULL
);
ProblemInstat
(
std
::
string
name
,
ProblemStat
&
prob
);
ProblemInstat
(
std
::
string
name
,
ProblemStat
Seq
&
prob
);
ProblemInstat
(
std
::
string
name
,
ProblemStat
&
prob
,
ProblemStatBase
&
initialProb
);
ProblemInstat
(
std
::
string
name
,
ProblemStat
Seq
&
prob
,
ProblemStatBase
&
initialProb
);
/// Destructor.
virtual
~
ProblemInstat
();
...
...
@@ -173,7 +173,7 @@ namespace AMDiS {
void
closeTimestep
(
AdaptInfo
*
adaptInfo
);
/// Returns \ref problemStat.
inline
ProblemStat
*
getStatProblem
()
inline
ProblemStat
Seq
*
getStatProblem
()
{
return
problemStat
;
}
...
...
@@ -198,7 +198,7 @@ namespace AMDiS {
protected:
/// Space problem solved in each timestep.
ProblemStat
*
problemStat
;
ProblemStat
Seq
*
problemStat
;
/// Solution of the last timestep.
SystemVector
*
oldSolution
;
...
...
AMDiS/src/parallel/MeshDistributor.cc
View file @
42860170
...
...
@@ -44,7 +44,7 @@
#include "StandardProblemIteration.h"
#include "VertexVector.h"
#include "MeshStructure.h"
#include "Problem
Vec
.h"
#include "Problem
Stat
.h"
#include "ProblemInstat.h"
#include "RefinementManager3d.h"
#include "Debug.h"
...
...
@@ -65,7 +65,7 @@ namespace AMDiS {
MeshDistributor
::
MeshDistributor
()
:
probStat
(
0
),
:
prob
lem
Stat
(
0
),
initialized
(
false
),
name
(
"parallel"
),
feSpace
(
NULL
),
...
...
@@ -336,20 +336,20 @@ namespace AMDiS {
}
void
MeshDistributor
::
addProblemStat
(
Problem
Vec
*
prob
Vec
)
void
MeshDistributor
::
addProblemStat
(
Problem
StatSeq
*
prob
Stat
)
{
FUNCNAME
(
"MeshDistributor::addProblem
Vec
()"
);
FUNCNAME
(
"MeshDistributor::addProblem
Stat
()"
);
if
(
feSpace
!=
NULL
)
{
vector
<
FiniteElemSpace
*>
feSpaces
=
prob
Vec
->
getFeSpaces
();
vector
<
FiniteElemSpace
*>
feSpaces
=
prob
Stat
->
getFeSpaces
();
for
(
unsigned
int
i
=
0
;
i
<
feSpaces
.
size
();
i
++
)
{
TEST_EXIT
(
feSpace
==
feSpaces
[
i
])
(
"Parallelizaton is not supported for multiple FE spaces!
\n
"
);
}
}
else
{
feSpace
=
prob
Vec
->
getFeSpace
(
0
);
feSpace
=
prob
Stat
->
getFeSpace
(
0
);
mesh
=
feSpace
->
getMesh
();
info
=
prob
Vec
->
getInfo
();
info
=
prob
Stat
->
getInfo
();
TEST_EXIT
(
mesh
->
getNumberOfDOFAdmin
()
==
1
)
(
"Only meshes with one DOFAdmin are supported!
\n
"
);
...
...
@@ -372,7 +372,7 @@ namespace AMDiS {
// Create parallel serialization file writer, if needed.
int
writeSerialization
=
0
;
Parameters
::
get
(
prob
Vec
->
getName
()
+
"->output->write serialization"
,
Parameters
::
get
(
prob
Stat
->
getName
()
+
"->output->write serialization"
,
writeSerialization
);
if
(
writeSerialization
&&
!
writeSerializationFile
)
{
string
filename
=
""
;
...
...
@@ -382,19 +382,19 @@ namespace AMDiS {
(
"No filename defined for parallel serialization file!
\n
"
);
int
tsModulo
=
-
1
;
Parameters
::
get
(
prob
Vec
->
getName
()
+
"->output->write every i-th timestep"
,
Parameters
::
get
(
prob
Stat
->
getName
()
+
"->output->write every i-th timestep"
,
tsModulo
);
prob
Vec
->
getFileWriterList
().
push_back
(
new
Serializer
<
MeshDistributor
>
(
this
,
filename
,
tsModulo
));
prob
Stat
->
getFileWriterList
().
push_back
(
new
Serializer
<
MeshDistributor
>
(
this
,
filename
,
tsModulo
));
writeSerializationFile
=
true
;
}
int
readSerialization
=
0
;
Parameters
::
get
(
prob
Vec
->
getName
()
+
"->input->read serialization"
,
Parameters
::
get
(
prob
Stat
->
getName
()
+
"->input->read serialization"
,
readSerialization
);
if
(
readSerialization
)
{
string
filename
=
""
;
Parameters
::
get
(
prob
Vec
->
getName
()
+
"->input->serialization filename"
,
Parameters
::
get
(
prob
Stat
->
getName
()
+
"->input->serialization filename"
,
filename
);
filename
+=
".p"
+
lexical_cast
<
string
>
(
mpiRank
);
MSG
(
"Start deserialization with %s
\n
"
,
filename
.
c_str
());
...
...
@@ -403,7 +403,7 @@ namespace AMDiS {
TEST_EXIT
(
!
in
.
fail
())(
"Could not open deserialization file: %s
\n
"
,
filename
.
c_str
());
prob
Vec
->
deserialize
(
in
);
prob
Stat
->
deserialize
(
in
);
in
.
close
();
MSG
(
"Deserialization from file: %s
\n
"
,
filename
.
c_str
());
...
...
@@ -425,13 +425,13 @@ namespace AMDiS {
deserialized
=
true
;
}
probStat
.
push_back
(
prob
Vec
);
prob
lem
Stat
.
push_back
(
prob
Stat
);
// If the mesh distributor is already initialized, don't forgett to set rank
// DOFs object to the matrices and vectors of the added stationary problem.
if
(
initialized
)
setRankDofs
(
prob
Vec
);
setRankDofs
(
prob
Stat
);
}
...
...
@@ -648,27 +648,27 @@ namespace AMDiS {
}
void
MeshDistributor
::
setRankDofs
(
Problem
Vec
*
prob
Vec
)
void
MeshDistributor
::
setRankDofs
(
Problem
StatSeq
*
prob
Stat
)
{
int
nComponents
=
prob
Vec
->
getNumComponents
();
int
nComponents
=
prob
Stat
->
getNumComponents
();
for
(
int
i
=
0
;
i
<
nComponents
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nComponents
;
j
++
)
if
(
prob
Vec
->
getSystemMatrix
(
i
,
j
))
prob
Vec
->
getSystemMatrix
(
i
,
j
)
->
setRankDofs
(
isRankDof
);
if
(
prob
Stat
->
getSystemMatrix
(
i
,
j
))
prob
Stat
->
getSystemMatrix
(
i
,
j
)
->
setRankDofs
(
isRankDof
);
TEST_EXIT_DBG
(
prob
Vec
->
getRhs
()
->
getDOFVector
(
i
))(
"No RHS vector!
\n
"
);
TEST_EXIT_DBG
(
prob
Vec
->
getSolution
()
->
getDOFVector
(
i
))(
"No solution vector!
\n
"
);
TEST_EXIT_DBG
(
prob
Stat
->
getRhs
()
->
getDOFVector
(
i
))(
"No RHS vector!
\n
"
);
TEST_EXIT_DBG
(
prob
Stat
->
getSolution
()
->
getDOFVector
(
i
))(
"No solution vector!
\n
"
);
prob
Vec
->
getRhs
()
->
getDOFVector
(
i
)
->
setRankDofs
(
isRankDof
);
prob
Vec
->
getSolution
()
->
getDOFVector
(
i
)
->
setRankDofs
(
isRankDof
);
prob
Stat
->
getRhs
()
->
getDOFVector
(
i
)
->
setRankDofs
(
isRankDof
);
prob
Stat
->
getSolution
()
->
getDOFVector
(
i
)
->
setRankDofs
(
isRankDof
);
}
}
void
MeshDistributor
::
setRankDofs
()
{
for
(
unsigned
int
i
=
0
;
i
<
probStat
.
size
();
i
++
)
setRankDofs
(
probStat
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
prob
lem
Stat
.
size
();
i
++
)
setRankDofs
(
prob
lem
Stat
[
i
]);
}
...
...
@@ -677,21 +677,21 @@ namespace AMDiS {
FUNCNAME
(
"MeshDistributor::removePeriodicBoundaryConditions()"
);
// Remove periodic boundaries in boundary manager on matrices and vectors.
for
(
unsigned
int
i
=
0
;
i
<
probStat
.
size
();
i
++
)
{
int
nComponents
=
probStat
[
i
]
->
getNumComponents
();
for
(
unsigned
int
i
=
0
;
i
<
prob
lem
Stat
.
size
();
i
++
)
{
int
nComponents
=
prob
lem
Stat
[
i
]
->
getNumComponents
();
for
(
int
j
=
0
;
j
<
nComponents
;
j
++
)
{
for
(
int
k
=
0
;
k
<
nComponents
;
k
++
)
{
DOFMatrix
*
mat
=
probStat
[
i
]
->
getSystemMatrix
(
j
,
k
);
DOFMatrix
*
mat
=
prob
lem
Stat
[
i
]
->
getSystemMatrix
(
j
,
k
);
if
(
mat
&&
mat
->
getBoundaryManager
())
removePeriodicBoundaryConditions
(
const_cast
<
BoundaryIndexMap
&>
(
mat
->
getBoundaryManager
()
->
getBoundaryConditionMap
()));
}
if
(
probStat
[
i
]
->
getSolution
()
->
getDOFVector
(
j
)
->
getBoundaryManager
())
removePeriodicBoundaryConditions
(
const_cast
<
BoundaryIndexMap
&>
(
probStat
[
i
]
->
getSolution
()
->
getDOFVector
(
j
)
->
getBoundaryManager
()
->
getBoundaryConditionMap
()));
if
(
prob
lem
Stat
[
i
]
->
getSolution
()
->
getDOFVector
(
j
)
->
getBoundaryManager
())
removePeriodicBoundaryConditions
(
const_cast
<
BoundaryIndexMap
&>
(
prob
lem
Stat
[
i
]
->
getSolution
()
->
getDOFVector
(
j
)
->
getBoundaryManager
()
->
getBoundaryConditionMap
()));
if
(
probStat
[
i
]
->
getRhs
()
->
getDOFVector
(
j
)
->
getBoundaryManager
())
removePeriodicBoundaryConditions
(
const_cast
<
BoundaryIndexMap
&>
(
probStat
[
i
]
->
getRhs
()
->
getDOFVector
(
j
)
->
getBoundaryManager
()
->
getBoundaryConditionMap
()));
if
(
prob
lem
Stat
[
i
]
->
getRhs
()
->
getDOFVector
(
j
)
->
getBoundaryManager
())
removePeriodicBoundaryConditions
(
const_cast
<
BoundaryIndexMap
&>
(
prob
lem
Stat
[
i
]
->
getRhs
()
->
getDOFVector
(
j
)
->
getBoundaryManager
()
->
getBoundaryConditionMap
()));
}
}
...
...
AMDiS/src/parallel/MeshDistributor.h
View file @
42860170
...
...
@@ -93,7 +93,7 @@ namespace AMDiS {
void
exitParallelization
();
void
addProblemStat
(
Problem
Vec
*
prob
Vec
);
void
addProblemStat
(
Problem
StatSeq
*
prob
Stat
);
/// Adds a DOFVector to the set of \ref interchangeVecs. Thus, this vector will
/// be automatically interchanged between ranks when mesh is repartitioned.
...
...
@@ -367,7 +367,7 @@ namespace AMDiS {
/// Sets \ref isRankDof to all matrices and rhs vectors in a given
/// stationary problem.
void
setRankDofs
(
Problem
Vec
*
prob
Vec
);
void
setRankDofs
(
Problem
StatSeq
*
prob
Stat
);
/// Sets \ref isRankDof to all matrices and rhs vectors in all stationary problems.
void
setRankDofs
();
...
...
@@ -443,7 +443,7 @@ namespace AMDiS {
protected:
/// List of all stationary problems that are managed by this mesh distributor.
vector
<
Problem
Vec
*>
probStat
;
vector
<
Problem
StatSeq
*>
prob
lem
Stat
;
/// If true, the mesh distributor is already initialized;
bool
initialized
;
...
...
AMDiS/src/parallel/ParallelDebug.cc
View file @
42860170
...
...
@@ -13,7 +13,7 @@
#include "parallel/ParallelDebug.h"
#include "parallel/MeshDistributor.h"
#include "parallel/MpiHelper.h"
#include "Problem
Vec
.h"
#include "Problem
Stat
.h"
#include "DOFVector.h"
#include "FixVec.h"
#include "StdMpi.h"
...
...
AMDiS/src/parallel/ParallelProblemStatBase.cc
View file @
42860170
...
...
@@ -23,7 +23,9 @@ namespace AMDiS {
FUNCNAME
(
"ParallelProblemStatBase::buildAfterCoarsen()"
);
meshDistributor
->
checkMeshChange
();
ProblemVec
::
buildAfterCoarsen
(
adaptInfo
,
flag
,
assembleMatrix
,
assembleVector
);
ProblemStatSeq
::
buildAfterCoarsen
(
adaptInfo
,
flag
,
assembleMatrix
,
assembleVector
);
double
vm
,
rss
;
processMemUsage
(
vm
,
rss
);
...
...
AMDiS/src/parallel/ParallelProblemStatBase.h
View file @
42860170
...
...
@@ -24,16 +24,16 @@
#define AMDIS_PARALLEL_PROBLEM_STAT_BASE_H
#include "parallel/MeshDistributor.h"
#include "Problem
Vec
.h"
#include "Problem
Stat
.h"
namespace
AMDiS
{
class
ParallelProblemStatBase
:
public
Problem
Vec
class
ParallelProblemStatBase
:
public
Problem
StatSeq
{
public:
ParallelProblemStatBase
(
std
::
string
nameStr
,
ProblemIterationInterface
*
problemIteration
=
NULL
)
:
Problem
Vec
(
nameStr
,
problemIteration
),
:
Problem
StatSeq
(
nameStr
,
problemIteration
),
meshDistributor
(
NULL
)
{}
...
...
@@ -51,6 +51,11 @@ namespace AMDiS {
protected:
MeshDistributor
*
meshDistributor
;
};
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
typedef
ProblemStatSeq
ProblemStat
;
#endif
}
#endif
AMDiS/src/time/RosenbrockStationary.cc
View file @
42860170
...
...
@@ -78,9 +78,9 @@ namespace AMDiS {
*
timeRhsVec
+=
*
tmp
;
}
ProblemStat
::
buildAfterCoarsen
(
adaptInfo
,
flag
,
(
i
==
0
),
asmVector
);
ProblemStat
Seq
::
buildAfterCoarsen
(
adaptInfo
,
flag
,
(
i
==
0
),
asmVector
);
solver
->
setMultipleRhs
(
i
!=
0
);
ProblemStat
::
solve
(
adaptInfo
);
ProblemStat
Seq
::
solve
(
adaptInfo
);
*
(
stageSolutions
[
i
])
=
*
solution
;
...
...
@@ -112,7 +112,7 @@ namespace AMDiS {
TEST_EXIT
(
op
.
getUhOld
()
==
NULL
)(
"UhOld is not allowed to be set!
\n
"
);
op
.
setUhOld
(
stageSolution
->
getDOFVector
(
col
));
ProblemStat
::
addVectorOperator
(
op
,
row
);
ProblemStat
Seq
::
addVectorOperator
(
op
,
row
);
}
...
...
@@ -124,7 +124,7 @@ namespace AMDiS {
TEST_EXIT
(
factor
==
NULL
)(
"Not yet implemented!
\n
"
);
TEST_EXIT
(
estFactor
==
NULL
)(
"Not yet implemented!
\n
"
);
ProblemStat
::
addMatrixOperator
(
op
,
row
,
col
,
&
minusOne
,
&
minusOne
);
ProblemStat
Seq
::
addMatrixOperator
(
op
,
row
,
col
,
&
minusOne
,
&
minusOne
);
}
...
...
@@ -136,11 +136,11 @@ namespace AMDiS {
Operator
*
op
=
new
Operator
(
componentSpaces
[
row
],
componentSpaces
[
col
]);
op
->
addZeroOrderTerm
(
new
Simple_ZOT
);
ProblemStat
::
addMatrixOperator
(
op
,
row
,
col
,
tauGamma
,
tauGamma
);
ProblemStat
Seq
::
addMatrixOperator
(
op
,
row
,
col
,
tauGamma
,
tauGamma
);
Operator
*
opRhs
=
new
Operator
(
componentSpaces
[
row
]);
opRhs
->
addZeroOrderTerm
(
new
VecAtQP_ZOT
(
timeRhsVec
->
getDOFVector
(
col
),
new
IdFunc
()));
ProblemStat
::
addVectorOperator
(
opRhs
,
row
,
&
minusOne
,
&
minusOne
);
ProblemStat
Seq
::
addVectorOperator
(
opRhs
,
row
,
&
minusOne
,
&
minusOne
);
}
...
...
@@ -153,7 +153,7 @@ namespace AMDiS {
RosenbrockBoundary
bound
=
{
fct
,
vec
,
row
,
col
};
boundaries
.
push_back
(
bound
);
ProblemStat
::
addDirichletBC
(
type
,
row
,
col
,
vec
);
ProblemStat
Seq
::
addDirichletBC
(
type
,
row
,
col
,
vec
);
}
}
AMDiS/src/time/RosenbrockStationary.h
View file @
42860170
...
...
@@ -42,7 +42,7 @@ namespace AMDiS {
};
class
RosenbrockStationary
:
public
ProblemStat
class
RosenbrockStationary
:
public
ProblemStat
Seq
{
public:
class
IdFunc
:
public
AbstractFunction
<
double
,
double
>
...
...
@@ -60,7 +60,7 @@ namespace AMDiS {
RosenbrockStationary
(
std
::
string
name
)
:
ProblemStat
(
name
),
:
ProblemStat
Seq
(
name
),
first
(
true
),
minusOne
(
-
1.0
),
tauPtr
(
NULL
),
...
...
Write
Preview
Supports
Markdown
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