Skip to content
GitLab
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
793a6125
Commit
793a6125
authored
Jun 19, 2015
by
Praetorius, Simon
Browse files
some small errors and warnings corrected
parent
c7d79308
Changes
10
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/Expressions.hh
View file @
793a6125
...
...
@@ -213,7 +213,7 @@ transformDOF_mm(Term term, DOFVector<T>* result)
assigned
.
set
(
0
);
temp
.
set
(
tmp
);
while
(
cont
)
{
while
(
cont
)
{
term
.
initElement
(
&
ot
,
dualElInfo
.
colElInfo
,
NULL
,
NULL
,
basisFcts
);
basisFcts
->
getLocalIndices
(
dualElInfo
.
rowElInfo
->
getElement
(),
resultFeSpace
->
getAdmin
(),
localIndices
);
...
...
@@ -245,6 +245,8 @@ transformDOF_mm(Term term, DOFVector<T>* result)
*
resultIter
=
(
*
tempIter
);
*
resultIter
/=
(
*
assignedIter
);
}
delete
lambda_1
;
}
}
// end namespace AMDiS
AMDiS/src/Mesh.cc
View file @
793a6125
...
...
@@ -1461,9 +1461,10 @@ namespace AMDiS {
else
{
ERROR_EXIT
(
"Parallel model only support dim = 2 or 3.
\n
"
);
return
;
}
refManager
->
globalRefine
(
&
testMesh
,
nParallelPreRefinements
);
refManager
->
globalRefine
(
&
testMesh
,
nParallelPreRefinements
);
delete
refManager
;
Lagrange
*
basFcts
=
Lagrange
::
getLagrange
(
dim
,
1
);
...
...
AMDiS/src/ProblemStat.cc
View file @
793a6125
...
...
@@ -178,20 +178,23 @@ namespace AMDiS {
if
(
adoptProblem
&&
(
adoptFlag
.
isSet
(
INIT_MESH
)
||
adoptFlag
.
isSet
(
INIT_SYSTEM
)
||
adoptFlag
.
isSet
(
INIT_FE_SPACE
)))
{
adoptFlag
.
isSet
(
INIT_FE_SPACE
)))
{
meshes
=
adoptProblem
->
getMeshes
();
componentMeshes
=
adoptProblem
->
componentMeshes
;
TEST_EXIT
(
adoptProblem
->
getNumAddComponents
()
+
nAddComponents
>
0
)
(
"Not yet implemented.
\n
"
);
// If the adopt problem has fewer components than this problem, but only one
// mesh for all component, than scal up the componentMeshes array.
if
(
adoptProblem
->
getNumComponents
()
<
nComponents
)
{
TEST_EXIT
(
meshes
.
size
()
==
1
)(
"Daran muss ich noch arbeiten!
\n
"
);
if
(
meshes
.
size
()
==
1
)
componentMeshes
.
resize
(
nComponents
,
meshes
[
0
]);
else
if
(
adoptProblem
->
getNumComponents
()
>=
nComponents
)
{
componentMeshes
.
resize
(
nComponents
);
for
(
int
i
=
adoptProblem
->
getNumComponents
();
i
<
nComponents
;
i
++
)
componentMeshes
[
i
]
=
componentMeshes
[
0
];
std
::
copy
(
adoptProblem
->
componentMeshes
.
begin
(),
adoptProblem
->
componentMeshes
.
begin
()
+
nComponents
,
componentMeshes
.
begin
());
}
else
{
componentMeshes
.
resize
(
nComponents
,
meshes
[
0
]);
WARNING
(
"componentMeshes may not be derived correctly from the adoptProblem. You have to do this manually!
\n
"
);
}
if
(
nAddComponents
>
0
)
{
WARNING
(
"Additional meshed can not be adopted from adoptProblem. You have to initialize these meshes manually!
\n
"
);
}
}
}
...
...
@@ -229,24 +232,26 @@ namespace AMDiS {
createFeSpace
(
NULL
);
if
(
adoptProblem
&&
(
adoptFlag
.
isSet
(
INIT_FE_SPACE
)
||
adoptFlag
.
isSet
(
INIT_SYSTEM
)))
{
(
adoptFlag
.
isSet
(
INIT_FE_SPACE
)
||
adoptFlag
.
isSet
(
INIT_SYSTEM
)))
{
feSpaces
=
adoptProblem
->
getFeSpaces
();
componentSpaces
=
adoptProblem
->
componentSpaces
;
traverseInfo
=
adoptProblem
->
traverseInfo
;
TEST_EXIT
(
adoptProblem
->
getNumAddComponents
()
+
nAddComponents
>
0
)
(
"Not yet implemented.
\n
"
);
// If the adopt problem has fewer components than this problem, but only one
// fe space for all component, than scal up the componentSpaces array.
if
(
adoptProblem
->
getNumComponents
()
<
nComponents
)
{
TEST_EXIT
(
feSpaces
.
size
()
==
1
)(
"Daran muss ich noch arbeiten!
\n
"
);
if
(
feSpaces
.
size
()
==
1
)
componentSpaces
.
resize
(
nComponents
,
feSpaces
[
0
]);
else
if
(
adoptProblem
->
getNumComponents
()
>=
nComponents
)
{
componentSpaces
.
resize
(
nComponents
);
for
(
int
i
=
adoptProblem
->
getNumComponents
();
i
<
nComponents
;
i
++
)
componentSpaces
[
i
]
=
componentSpaces
[
0
];
std
::
copy
(
adoptProblem
->
componentSpaces
.
begin
(),
adoptProblem
->
componentSpaces
.
begin
()
+
nComponents
,
componentSpaces
.
begin
());
}
else
{
componentSpaces
.
resize
(
nComponents
,
feSpaces
[
0
]);
WARNING
(
"componentSpaces may not be derived correctly from the adoptProblem. You have to do this manually!
\n
"
);
}
if
(
nAddComponents
>
0
)
{
WARNING
(
"Additional feSpaces can not be adopted from adoptProblem. You have to initialize these fespaces manually!
\n
"
);
}
}
}
...
...
@@ -276,10 +281,8 @@ namespace AMDiS {
}
}
// #ifndef HAVE_PARALLEL_DOMAIN_AMDIS
if
(
!
solver
)
WARNING
(
"no solver created
\n
"
);
// #endif
// === create estimator ===
if
(
initFlag
.
isSet
(
INIT_ESTIMATOR
))
...
...
AMDiS/src/ProblemStat.h
View file @
793a6125
...
...
@@ -147,17 +147,6 @@ namespace AMDiS {
void
dualAssemble
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
asmMatrix
=
true
,
bool
asmVector
=
true
);
/// Determines the execution order of the single adaption steps. If adapt is
/// true, mesh adaption will be performed. This allows to avoid mesh adaption,
/// e.g. in timestep adaption loops of timestep adaptive strategies.
Flag
oneIteration
(
AdaptInfo
*
adaptInfo
,
Flag
toDo
=
FULL_ITERATION
)
override
;
/// Returns number of managed problems
int
getNumProblems
()
override
{
return
1
;
}
/// Implementation of ProblemStatBase::getNumComponents(), TODO: Wrong!!
virtual
int
getNumComponents
()
{
...
...
@@ -169,13 +158,6 @@ namespace AMDiS {
return
nAddComponents
;
}
/// Returns the problem with the given number. If only one problem
/// is managed by this master problem, the number hasn't to be given.
ProblemStatBase
*
getProblem
(
int
number
=
0
)
override
{
return
this
;
}
/// Writes output files. TODO: Make obsolete.
void
writeFiles
(
AdaptInfo
*
adaptInfo
,
bool
force
);
...
...
@@ -557,11 +539,13 @@ namespace AMDiS {
return
fileWriters
;
}
/// Returns \ref solutionTime.
double
getSolutionTime
()
{
return
solutionTime
;
}
/// Returns \ref buildTime.
double
getBuildTime
()
{
return
buildTime
;
...
...
@@ -687,36 +671,64 @@ namespace AMDiS {
std
::
map
<
Operator
*
,
std
::
vector
<
OperatorPos
>
>
operators
;
/// time needed to solve the linear system
double
solutionTime
;
/// time needed to assemble the linear system
double
buildTime
;
template
<
class
>
friend
class
detail
::
CouplingProblemStat
;
};
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
struct
ProblemStat
:
public
ProblemStatSeq
,
public
StandardProblemIteration
namespace
detail
{
typedef
ProblemStatSeq
super
;
using
super
::
getName
;
ProblemStat
(
std
::
string
nameStr
,
ProblemIterationInterface
*
problemIteration
=
NULL
)
:
super
(
nameStr
,
problemIteration
),
StandardProblemIteration
(
this
)
{
}
Flag
oneIteration
(
AdaptInfo
*
adaptInfo
,
Flag
toDo
)
template
<
class
ProblemStatType
>
struct
ProblemStat
:
public
ProblemStatType
,
public
StandardProblemIteration
{
for
(
int
i
=
0
;
i
<
getNumComponents
();
i
++
)
if
(
adaptInfo
->
spaceToleranceReached
(
i
))
adaptInfo
->
allowRefinement
(
false
,
i
);
else
adaptInfo
->
allowRefinement
(
true
,
i
);
return
StandardProblemIteration
::
oneIteration
(
adaptInfo
,
toDo
);
}
};
using
ProblemStatType
::
getName
;
/// Constructor
ProblemStat
(
std
::
string
nameStr
,
ProblemIterationInterface
*
problemIteration
=
NULL
)
:
ProblemStatType
(
nameStr
,
problemIteration
),
StandardProblemIteration
(
this
)
{
}
/// Returns number of managed problems
// implements StandardProblemIteration::getNumProblems()
virtual
int
getNumProblems
()
override
{
return
1
;
}
/// Returns the problem with the given number. If only one problem
/// is managed by this master problem, the number hasn't to be given.
// implements StandardProblemIteration::getProblem(int)
virtual
ProblemStatBase
*
getProblem
(
int
number
=
0
)
override
{
return
this
;
}
/// Determines the execution order of the single adaption steps. If adapt is
/// true, mesh adaption will be performed. This allows to avoid mesh adaption,
/// e.g. in timestep adaption loops of timestep adaptive strategies.
// implements StandardProblemIteration::oneIteration(AdaptInfo*, Flag)
virtual
Flag
oneIteration
(
AdaptInfo
*
adaptInfo
,
Flag
toDo
=
FULL_ITERATION
)
override
{
for
(
int
i
=
0
;
i
<
ProblemStatType
::
getNumComponents
();
i
++
)
if
(
adaptInfo
->
spaceToleranceReached
(
i
))
adaptInfo
->
allowRefinement
(
false
,
i
);
else
adaptInfo
->
allowRefinement
(
true
,
i
);
return
StandardProblemIteration
::
oneIteration
(
adaptInfo
,
toDo
);
}
};
}
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
typedef
detail
::
ProblemStat
<
ProblemStatSeq
>
ProblemStat
;
#endif
}
...
...
AMDiS/src/io/detail/Arh3Reader.cc
View file @
793a6125
...
...
@@ -35,16 +35,16 @@ namespace AMDiS { namespace io {
file
.
read
(
const_cast
<
char
*>
(
typeId
.
data
()),
4
);
TEST_EXIT
(
typeId
==
id
)
(
"Cannot read Arh
2
format: this file is not
\"
arh2
\"
format.
\n
"
);
(
"Cannot read Arh format: this file is not
\"
%s
\"
format.
\n
"
,
id
.
c_str
()
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
major_
),
1
);
TEST_EXIT
(
major
==
major_
)
(
"Cannot read Arh
2
format: Arh2Reader major version is %i, the file major version is %i.
\n
"
,
(
"Cannot read Arh format: Arh2Reader major version is %i, the file major version is %i.
\n
"
,
major
,
major_
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
minor_
),
1
);
TEST_EXIT
(
minor
<=
minor_
)
(
"Cannot read Arh
2
format: Arh
2
Reader minor version is %i is smaller than the file minor version %i.
\n
"
,
(
"Cannot read Arh format: ArhReader minor version is %i is smaller than the file minor version %i.
\n
"
,
minor
,
minor_
);
}
...
...
@@ -344,7 +344,7 @@ namespace AMDiS { namespace io {
if
((
*
nDOF
)[
0
]
!=
feSpaceDOFs
[
vecsFeSpaceNum
[
i
]][
3
])
matchdof
=
false
;
else
{
for
(
size_
t
j
=
1
;
j
<
nDOF
->
getSize
();
j
++
)
{
for
(
in
t
j
=
1
;
j
<
nDOF
->
getSize
();
j
++
)
{
if
((
*
nDOF
)[
j
]
!=
feSpaceDOFs
[
vecsFeSpaceNum
[
i
]][
j
-
1
]){
matchdof
=
false
;
break
;
...
...
@@ -373,7 +373,7 @@ namespace AMDiS { namespace io {
TEST_EXIT
((
*
nDOF
)[
0
]
==
feSpaceDOFs
[
vecsFeSpaceNum
[
i
]][
3
])
(
"The fespace of vec number %i is not equal to the correspond fespace.
\n
"
,
i
+
1
);
for
(
size_
t
j
=
1
;
j
<
nDOF
->
getSize
();
j
++
)
for
(
in
t
j
=
1
;
j
<
nDOF
->
getSize
();
j
++
)
TEST_EXIT
((
*
nDOF
)[
j
]
==
feSpaceDOFs
[
vecsFeSpaceNum
[
i
]][
j
-
1
])
(
"The fespace of vec number %i is not equal to the correspond fespace.
\n
"
,
i
+
1
);
}
...
...
@@ -498,12 +498,13 @@ namespace AMDiS { namespace io {
template
<
typename
T
>
void
readValues
(
stringstream
&
file
,
vector
<
double
>&
values
)
{
in
t
size
=
values
.
size
();
T
data
[
size
];
size_
t
size
=
values
.
size
();
T
*
data
=
new
T
[
size
];
file
.
read
(
reinterpret_cast
<
char
*>
(
&
data
[
0
]),
sizeof
(
T
)
*
size
);
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
values
[
i
]
=
static_cast
<
double
>
(
data
[
i
]);
delete
data
;
}
void
readFile
(
string
filename
,
Mesh
*
mesh
,
...
...
@@ -585,11 +586,13 @@ namespace AMDiS { namespace io {
nMacros
=
mesh
->
getNumberOfMacros
();
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
Parallel
::
mpi
::
globalAdd
(
nMacros
);
if
(
MPI
::
COMM_WORLD
.
Get_rank
()
==
0
)
if
(
MPI
::
COMM_WORLD
.
Get_rank
()
==
0
)
#endif
{
TEST_EXIT
(
nMacros
==
nMacros_
)
(
"Number of macro elements in parallel ARH files doesn't match to the current runtime. %d vs %d
\n
"
,
nMacros
,
nMacros_
);
}
if
(
!
parh
)
{
for
(
int
i
=
0
;
i
<
nProcs
;
i
++
)
{
...
...
@@ -818,7 +821,7 @@ namespace AMDiS { namespace io {
file
.
read
(
const_cast
<
char
*>
(
macroFilename
.
data
()),
macroFile_nl
);
uint32_t
rank
=
0
;
for
(
size_
t
i
=
0
;
i
<
nMacros
;
i
++
)
{
for
(
in
t
i
=
0
;
i
<
nMacros
;
i
++
)
{
file
.
read
(
reinterpret_cast
<
char
*>
(
&
rank
),
4
);
partition
.
push_back
(
rank
);
}
...
...
AMDiS/src/io/detail/Arh3Writer.cc
View file @
793a6125
...
...
@@ -120,9 +120,7 @@ namespace AMDiS { namespace io {
Mesh
*
mesh_
=
mesh
?
mesh
:
vecs
[
0
]
->
getFeSpace
()
->
getMesh
();
if
(
MPI
::
COMM_WORLD
.
Get_rank
()
==
0
)
{
writeParallelFile
(
name
+
".parh"
,
mesh
?
mesh
:
vecs
[
0
]
->
getFeSpace
()
->
getMesh
(),
filenameType
);
writeParallelFile
(
name
+
".parh"
,
mesh_
,
filenameType
);
}
TEST_EXIT
(
filenameType
==
"cont"
)(
"Only filename type
\"
cont
\"
.
\n
"
);
...
...
@@ -195,7 +193,7 @@ namespace AMDiS { namespace io {
string
dataformat
)
{
FUNCNAME
(
"Arh3Writer::detail::writeHeader()"
);
int
nbits
=
boost
::
lexical_cast
<
int
>
(
dataformat
.
substr
(
2
,
2
));
//
int nbits = boost::lexical_cast<int>(dataformat.substr(2, 2));
TEST_EXIT
(
file
.
is_open
())(
"the file is not open. should not happen.
\n
"
);
map
<
const
FiniteElemSpace
*
,
string
>
AFEDfileName
;
...
...
@@ -277,11 +275,11 @@ namespace AMDiS { namespace io {
file
.
write
(
nameStr
.
c_str
(),
nameStrLen
);
DimVec
<
int
>*
nDOF
=
feSpaceIt
->
first
->
getBasisFcts
()
->
getNumberOfDofs
();
//
for
(
size_
t
j
=
1
;
j
<
nDOF
->
getSize
();
j
++
)
{
for
(
in
t
j
=
1
;
j
<
nDOF
->
getSize
();
j
++
)
{
posDOFs
=
(
*
nDOF
)[
j
];
file
.
write
(
reinterpret_cast
<
char
*>
(
&
posDOFs
),
4
);
}
for
(
size_
t
j
=
nDOF
->
getSize
();
j
<
4
;
j
++
)
{
for
(
in
t
j
=
nDOF
->
getSize
();
j
<
4
;
j
++
)
{
posDOFs
=
0
;
file
.
write
(
reinterpret_cast
<
char
*>
(
&
posDOFs
),
4
);
}
...
...
@@ -537,12 +535,13 @@ namespace AMDiS { namespace io {
template
<
typename
T
>
int
writeValues
(
stringstream
&
file
,
vector
<
double
>&
values
)
{
in
t
size
=
values
.
size
();
T
data
[
size
];
size_
t
size
=
values
.
size
();
T
*
data
=
new
T
[
size
];
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
data
[
i
]
=
static_cast
<
T
>
(
values
[
i
]);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
data
[
0
]),
sizeof
(
T
)
*
size
);
delete
data
;
return
sizeof
(
T
)
*
size
;
}
...
...
AMDiS/src/parallel/ParallelProblemStat.cc
View file @
793a6125
...
...
@@ -88,7 +88,7 @@ namespace AMDiS { namespace Parallel {
std
::
vector
<
const
FiniteElemSpace
*>
tmpFeSpaces
,
tmpComponentSpaces
(
getComponentSpaces
().
begin
(),
getComponentSpaces
().
begin
()
+
getNumComponents
());
for
(
in
t
i
=
0
;
i
<
tmpComponentSpaces
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
tmpComponentSpaces
.
size
();
i
++
)
if
(
std
::
find
(
tmpFeSpaces
.
begin
(),
tmpFeSpaces
.
end
(),
tmpComponentSpaces
[
i
])
==
tmpFeSpaces
.
end
())
tmpFeSpaces
.
push_back
(
tmpComponentSpaces
[
i
]);
...
...
AMDiS/src/parallel/ParallelProblemStat.h
View file @
793a6125
...
...
@@ -77,29 +77,7 @@ namespace AMDiS
}
// end namespace Parallel
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
struct
ProblemStat
:
public
Parallel
::
ParallelProblemStat
,
public
StandardProblemIteration
{
typedef
Parallel
::
ParallelProblemStat
super
;
using
super
::
getName
;
ProblemStat
(
std
::
string
nameStr
,
ProblemIterationInterface
*
problemIteration
=
NULL
)
:
super
(
nameStr
,
problemIteration
),
StandardProblemIteration
(
this
)
{
}
Flag
oneIteration
(
AdaptInfo
*
adaptInfo
,
Flag
toDo
)
{
for
(
int
i
=
0
;
i
<
getNumComponents
();
i
++
)
if
(
adaptInfo
->
spaceToleranceReached
(
i
))
adaptInfo
->
allowRefinement
(
false
,
i
);
else
adaptInfo
->
allowRefinement
(
true
,
i
);
return
StandardProblemIteration
::
oneIteration
(
adaptInfo
,
toDo
);
}
};
typedef
detail
::
ProblemStat
<
Parallel
::
ParallelProblemStat
>
ProblemStat
;
#endif
}
// end namespace AMDiS
...
...
AMDiS/src/parallel/StdMpi.cc
View file @
793a6125
...
...
@@ -633,7 +633,7 @@ namespace AMDiS { namespace Parallel {
void
StdMpiHelper
<
vector
<
Matrix
<
int
>
>
>::
createBuffer
(
vector
<
Matrix
<
int
>
>
&
data
,
int
*
buf
)
{
int
dimOfWorld
=
Global
::
getGeo
(
WORLD
);
//
int dimOfWorld = Global::getGeo(WORLD);
int
pos
=
0
;
buf
[
pos
++
]
=
data
.
size
()
>
0
?
data
[
0
].
getNumRows
()
:
0
;
buf
[
pos
++
]
=
data
.
size
()
>
0
?
data
[
0
].
getNumCols
()
:
0
;
...
...
extensions/BackgroundMesh.hh
View file @
793a6125
...
...
@@ -30,7 +30,7 @@ namespace AMDiS { namespace extensions {
template
<
typename
T
>
T
Box
::
evalAtPoint
(
const
DOFVector
<
T
>&
vec
,
const
PointType
&
x
,
int
strategy
,
int
nrOfPoints
)
{
T
value
;
T
value
=
0
;
switch
(
strategy
)
{
case
0
:
value
=
evalAtPoint_simple
(
vec
,
x
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment