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
Open sidebar
Aland, Sebastian
amdis
Commits
9a682f9d
Commit
9a682f9d
authored
Aug 21, 2012
by
Thomas Witkowski
Browse files
Modified some files to make use of const FiniteElemSpace pointers, where this is possible.
parent
0d0838bd
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
110 additions
and
186 deletions
+110
-186
AMDiS/src/BoundaryCondition.h
AMDiS/src/BoundaryCondition.h
+17
-27
AMDiS/src/ComponentTraverseInfo.h
AMDiS/src/ComponentTraverseInfo.h
+5
-5
AMDiS/src/DirichletBC.cc
AMDiS/src/DirichletBC.cc
+2
-2
AMDiS/src/DirichletBC.h
AMDiS/src/DirichletBC.h
+2
-2
AMDiS/src/MatrixVector.cc
AMDiS/src/MatrixVector.cc
+2
-2
AMDiS/src/MatrixVector.h
AMDiS/src/MatrixVector.h
+1
-1
AMDiS/src/PeriodicBC.cc
AMDiS/src/PeriodicBC.cc
+1
-1
AMDiS/src/PeriodicBC.h
AMDiS/src/PeriodicBC.h
+1
-1
AMDiS/src/ProblemStat.cc
AMDiS/src/ProblemStat.cc
+2
-4
AMDiS/src/ProblemStat.h
AMDiS/src/ProblemStat.h
+8
-8
AMDiS/src/RobinBC.cc
AMDiS/src/RobinBC.cc
+6
-6
AMDiS/src/RobinBC.h
AMDiS/src/RobinBC.h
+10
-10
AMDiS/src/SystemVector.cc
AMDiS/src/SystemVector.cc
+12
-2
AMDiS/src/SystemVector.h
AMDiS/src/SystemVector.h
+37
-48
AMDiS/src/parallel/ParallelCoarseSpaceMatVec.cc
AMDiS/src/parallel/ParallelCoarseSpaceMatVec.cc
+1
-1
AMDiS/src/parallel/PetscSolver.cc
AMDiS/src/parallel/PetscSolver.cc
+0
-36
AMDiS/src/parallel/PetscSolver.h
AMDiS/src/parallel/PetscSolver.h
+0
-6
AMDiS/src/parallel/PetscSolverFeti.cc
AMDiS/src/parallel/PetscSolverFeti.cc
+2
-2
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
+1
-18
AMDiS/src/parallel/PetscSolverGlobalMatrix.h
AMDiS/src/parallel/PetscSolverGlobalMatrix.h
+0
-4
No files found.
AMDiS/src/BoundaryCondition.h
View file @
9a682f9d
...
...
@@ -80,22 +80,18 @@ namespace AMDiS {
/// Destructor.
virtual
~
BoundaryCondition
()
{}
/** \brief
* Adds the local boundary condition for elInfo to object.
* The dofIndices and localBound as well as nBasFcts are determined by
* the calling BoundaryManager.
*/
/// Adds the local boundary condition for elInfo to object.
/// The dofIndices and localBound as well as nBasFcts are determined by
// the calling BoundaryManager.
virtual
void
fillBoundaryCondition
(
DOFMatrix
*
matrix
,
ElInfo
*
elInfo
,
const
DegreeOfFreedom
*
dofIndices
,
const
BoundaryType
*
localBound
,
int
nBasFcts
)
{}
/** \brief
* Adds the local boundary condition for elInfo to vector.
* The dofIndices and localBound as well as nBasFcts are determined by
* the calling BoundaryManager.
*/
/// Adds the local boundary condition for elInfo to vector.
/// The dofIndices and localBound as well as nBasFcts are determined by
/// the calling BoundaryManager.
virtual
void
fillBoundaryCondition
(
DOFVectorBase
<
double
>
*
vector
,
ElInfo
*
elInfo
,
const
DegreeOfFreedom
*
dofIndices
,
...
...
@@ -110,10 +106,8 @@ namespace AMDiS {
return
0.0
;
}
/** \brief
* Returns whether the condition must be treated as Dirichlet condition
* while assemblage.
*/
/// Returns whether the condition must be treated as Dirichlet condition
/// while assemblage.
virtual
bool
isDirichlet
()
{
return
false
;
...
...
@@ -125,25 +119,21 @@ namespace AMDiS {
return
false
;
}
/** \brief
* In some situations it may be required to set Dirichlet boundary conditions,
* but not to apply them to the matrix. This is for example the case, if the
* boundary condition is set to a couple matrix. Then, the boundary conditions
* must be applied to the couple matrix, but they are set to all matrices in this
* row (to ensure that there are no other element entries in the Dirichlet boundary
* condition rows).
*/
/// In some situations it may be required to set Dirichlet boundary
/// conditions, but not to apply them to the matrix. This is for example the
/// case, if the boundary condition is set to a couple matrix. Then, the
/// boundary conditions must be applied to the couple matrix, but they are
/// set to all matrices in this row (to ensure that there are no other
/// element entries in the Dirichlet boundary condition rows).
virtual
bool
applyBoundaryCondition
()
{
return
true
;
}
protected:
/** \brief
* Speciefies for which parts of the boundary the condition holds.
* This id corresponds to the boundary numbers spcified in the
* macro file.
*/
/// Speciefies for which parts of the boundary the condition holds.
/// This id corresponds to the boundary numbers spcified in the
/// macro file.
BoundaryType
boundaryType
;
/// FiniteElemSpace for this BoundaryCondition.
...
...
AMDiS/src/ComponentTraverseInfo.h
View file @
9a682f9d
...
...
@@ -38,7 +38,7 @@ namespace AMDiS {
status
(
0
)
{}
void
setFeSpace
(
FiniteElemSpace
*
row
,
FiniteElemSpace
*
col
=
NULL
)
void
setFeSpace
(
const
FiniteElemSpace
*
row
,
const
FiniteElemSpace
*
col
=
NULL
)
{
rowFeSpace
=
row
;
colFeSpace
=
col
;
...
...
@@ -66,12 +66,12 @@ namespace AMDiS {
return
auxFeSpaces
.
size
();
}
FiniteElemSpace
*
getRowFeSpace
()
const
FiniteElemSpace
*
getRowFeSpace
()
{
return
rowFeSpace
;
}
FiniteElemSpace
*
getColFeSpace
()
const
FiniteElemSpace
*
getColFeSpace
()
{
return
colFeSpace
;
}
...
...
@@ -94,9 +94,9 @@ namespace AMDiS {
}
protected:
FiniteElemSpace
*
rowFeSpace
;
const
FiniteElemSpace
*
rowFeSpace
;
FiniteElemSpace
*
colFeSpace
;
const
FiniteElemSpace
*
colFeSpace
;
std
::
set
<
const
FiniteElemSpace
*>
auxFeSpaces
;
...
...
AMDiS/src/DirichletBC.cc
View file @
9a682f9d
...
...
@@ -20,8 +20,8 @@ namespace AMDiS {
DirichletBC
::
DirichletBC
(
BoundaryType
type
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
fct
,
FiniteElemSpace
*
rowFeSpace
,
FiniteElemSpace
*
colFeSpace
,
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
,
bool
apply
)
:
BoundaryCondition
(
type
,
rowFeSpace
,
colFeSpace
),
f
(
fct
),
...
...
AMDiS/src/DirichletBC.h
View file @
9a682f9d
...
...
@@ -45,8 +45,8 @@ namespace AMDiS {
/// Constructor.
DirichletBC
(
BoundaryType
type
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
fct
,
FiniteElemSpace
*
rowFeSpace
,
FiniteElemSpace
*
colFeSpace
=
NULL
,
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
=
NULL
,
bool
apply
=
true
);
/// Constructor.
...
...
AMDiS/src/MatrixVector.cc
View file @
9a682f9d
...
...
@@ -16,9 +16,9 @@
namespace
AMDiS
{
vector
<
const
FiniteElemSpace
*>
getFeSpaces
(
Matrix
<
DOFMatrix
*>
&
mat
)
vector
<
const
FiniteElemSpace
*>
get
Component
FeSpaces
(
Matrix
<
DOFMatrix
*>
&
mat
)
{
FUNCNAME
(
"getFeSpaces()"
);
FUNCNAME
(
"get
Component
FeSpaces()"
);
int
nComponents
=
mat
.
getNumRows
();
vector
<
const
FiniteElemSpace
*>
result
(
nComponents
);
...
...
AMDiS/src/MatrixVector.h
View file @
9a682f9d
...
...
@@ -521,7 +521,7 @@ namespace AMDiS {
/// Returns a vector with the FE spaces of each row in the matrix. Thus, the
/// resulting vector may contain the same FE space multiple times.
vector
<
const
FiniteElemSpace
*>
getFeSpaces
(
Matrix
<
DOFMatrix
*>
&
mat
);
vector
<
const
FiniteElemSpace
*>
get
Component
FeSpaces
(
Matrix
<
DOFMatrix
*>
&
mat
);
}
#endif // AMDIS_MATRIXVECTOR_H
AMDiS/src/PeriodicBC.cc
View file @
9a682f9d
...
...
@@ -97,7 +97,7 @@ namespace AMDiS {
}
PeriodicBC
::
PeriodicBC
(
BoundaryType
type
,
FiniteElemSpace
*
rowSpace
)
PeriodicBC
::
PeriodicBC
(
BoundaryType
type
,
const
FiniteElemSpace
*
rowSpace
)
:
BoundaryCondition
(
type
,
rowSpace
,
NULL
),
masterMatrix
(
NULL
)
{
...
...
AMDiS/src/PeriodicBC.h
View file @
9a682f9d
...
...
@@ -88,7 +88,7 @@ namespace AMDiS {
{
public:
/// Constructor.
PeriodicBC
(
BoundaryType
type
,
FiniteElemSpace
*
rowFeSpace
);
PeriodicBC
(
BoundaryType
type
,
const
FiniteElemSpace
*
rowFeSpace
);
~
PeriodicBC
();
...
...
AMDiS/src/ProblemStat.cc
View file @
9a682f9d
...
...
@@ -1586,9 +1586,7 @@ namespace AMDiS {
FUNCNAME
(
"ProblemStat::addPeriodicBC()"
);
boundaryConditionSet
=
true
;
FiniteElemSpace
*
feSpace
=
componentSpaces
[
row
];
PeriodicBC
*
periodic
=
new
PeriodicBC
(
type
,
feSpace
);
PeriodicBC
*
periodic
=
new
PeriodicBC
(
type
,
componentSpaces
[
row
]);
if
(
systemMatrix
&&
(
*
systemMatrix
)[
row
][
col
])
(
*
systemMatrix
)[
row
][
col
]
->
getBoundaryManager
()
->
addBoundaryCondition
(
periodic
);
...
...
@@ -1628,7 +1626,7 @@ namespace AMDiS {
}
void
ProblemStatSeq
::
assembleOnOneMesh
(
FiniteElemSpace
*
feSpace
,
void
ProblemStatSeq
::
assembleOnOneMesh
(
const
FiniteElemSpace
*
feSpace
,
Flag
assembleFlag
,
DOFMatrix
*
matrix
,
DOFVector
<
double
>
*
vector
)
...
...
AMDiS/src/ProblemStat.h
View file @
9a682f9d
...
...
@@ -256,7 +256,7 @@ namespace AMDiS {
/// This function assembles a DOFMatrix and a DOFVector for the case,
/// the meshes from row and col FE-space are equal.
void
assembleOnOneMesh
(
FiniteElemSpace
*
feSpace
,
void
assembleOnOneMesh
(
const
FiniteElemSpace
*
feSpace
,
Flag
assembleFlag
,
DOFMatrix
*
matrix
,
DOFVector
<
double
>
*
vector
);
...
...
@@ -321,7 +321,7 @@ namespace AMDiS {
}
/// Returns \ref feSpace_.
inline
FiniteElemSpace
*
getFeSpace
(
int
comp
=
0
)
inline
const
FiniteElemSpace
*
getFeSpace
(
int
comp
=
0
)
{
FUNCNAME
(
"ProblemStatSeq::getFeSpace()"
);
TEST_EXIT
(
comp
<
static_cast
<
int
>
(
componentSpaces
.
size
())
&&
comp
>=
0
)
...
...
@@ -330,13 +330,13 @@ namespace AMDiS {
}
/// Returns \ref feSpaces.
inline
vector
<
FiniteElemSpace
*>
getFeSpaces
()
inline
vector
<
const
FiniteElemSpace
*>
getFeSpaces
()
{
return
feSpaces
;
}
/// Returns \ref componentSpaces;
inline
vector
<
FiniteElemSpace
*>
getComponentFeSpaces
()
inline
vector
<
const
FiniteElemSpace
*>
getComponentFeSpaces
()
{
return
componentSpaces
;
}
...
...
@@ -428,12 +428,12 @@ namespace AMDiS {
}
/// Sets the FE space for the given component.
inline
void
setFeSpace
(
FiniteElemSpace
*
feSpace
,
int
comp
=
0
)
inline
void
setFeSpace
(
const
FiniteElemSpace
*
feSpace
,
int
comp
=
0
)
{
feSpaces
[
comp
]
=
feSpace
;
}
void
setComponentSpace
(
int
comp
,
FiniteElemSpace
*
feSpace
)
void
setComponentSpace
(
int
comp
,
const
FiniteElemSpace
*
feSpace
)
{
if
(
static_cast
<
int
>
(
componentSpaces
.
size
())
<
nComponents
)
componentSpaces
.
resize
(
nComponents
);
...
...
@@ -565,13 +565,13 @@ namespace AMDiS {
int
nMeshes
;
/// FE spaces of this problem.
vector
<
FiniteElemSpace
*>
feSpaces
;
vector
<
const
FiniteElemSpace
*>
feSpaces
;
/// Meshes of this problem.
vector
<
Mesh
*>
meshes
;
/// Pointer to the fe spaces for the different problem components
vector
<
FiniteElemSpace
*>
componentSpaces
;
vector
<
const
FiniteElemSpace
*>
componentSpaces
;
/// Pointer to the meshes for the different problem components
vector
<
Mesh
*>
componentMeshes
;
...
...
AMDiS/src/RobinBC.cc
View file @
9a682f9d
...
...
@@ -24,8 +24,8 @@ namespace AMDiS {
RobinBC
::
RobinBC
(
BoundaryType
type
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
j
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
alpha
,
FiniteElemSpace
*
rowFeSpace_
,
FiniteElemSpace
*
colFeSpace_
)
const
FiniteElemSpace
*
rowFeSpace_
,
const
FiniteElemSpace
*
colFeSpace_
)
:
BoundaryCondition
(
type
,
rowFeSpace_
,
colFeSpace_
),
neumannOperators
(
NULL
),
robinOperators
(
NULL
)
...
...
@@ -75,8 +75,8 @@ namespace AMDiS {
RobinBC
::
RobinBC
(
BoundaryType
type
,
DOFVectorBase
<
double
>
*
j
,
DOFVectorBase
<
double
>
*
alpha
,
FiniteElemSpace
*
rowFeSpace_
,
FiniteElemSpace
*
colFeSpace_
)
const
FiniteElemSpace
*
rowFeSpace_
,
const
FiniteElemSpace
*
colFeSpace_
)
:
BoundaryCondition
(
type
,
rowFeSpace_
,
colFeSpace_
),
neumannOperators
(
NULL
),
robinOperators
(
NULL
)
...
...
@@ -125,8 +125,8 @@ namespace AMDiS {
RobinBC
::
RobinBC
(
BoundaryType
type
,
Operator
*
jOp
,
Operator
*
alphaOp
,
FiniteElemSpace
*
rowFeSpace_
,
FiniteElemSpace
*
colFeSpace_
)
const
FiniteElemSpace
*
rowFeSpace_
,
const
FiniteElemSpace
*
colFeSpace_
)
:
BoundaryCondition
(
type
,
rowFeSpace_
,
colFeSpace_
),
neumannOperators
(
NULL
),
robinOperators
(
NULL
)
...
...
AMDiS/src/RobinBC.h
View file @
9a682f9d
...
...
@@ -45,21 +45,21 @@ namespace AMDiS {
RobinBC
(
BoundaryType
type
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
j
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
alpha
,
FiniteElemSpace
*
rowFeSpace
,
FiniteElemSpace
*
colFeSpace
=
NULL
);
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
=
NULL
);
/// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as DOFVectors.
RobinBC
(
BoundaryType
type
,
DOFVectorBase
<
double
>
*
j
,
DOFVectorBase
<
double
>
*
alpha
,
FiniteElemSpace
*
rowFeSpace
,
FiniteElemSpace
*
colFeSpace
=
NULL
);
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
=
NULL
);
/// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as Operator objects.
RobinBC
(
BoundaryType
type
,
Operator
*
jOp
,
Operator
*
alphaOp
,
FiniteElemSpace
*
rowFeSpace
,
FiniteElemSpace
*
colFeSpace
=
NULL
);
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
=
NULL
);
/// Implements BoundaryCondition::fillBoundaryCondition();
virtual
void
fillBoundaryCondition
(
DOFMatrix
*
matrix
,
...
...
@@ -96,15 +96,15 @@ namespace AMDiS {
public:
NeumannBC
(
BoundaryType
type
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
j
,
FiniteElemSpace
*
rowFeSpace
,
FiniteElemSpace
*
colFeSpace
=
NULL
)
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
=
NULL
)
:
RobinBC
(
type
,
j
,
NULL
,
rowFeSpace
,
colFeSpace
)
{}
NeumannBC
(
BoundaryType
type
,
DOFVectorBase
<
double
>
*
j
,
FiniteElemSpace
*
rowFeSpace
,
FiniteElemSpace
*
colFeSpace
=
NULL
)
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
=
NULL
)
:
RobinBC
(
type
,
j
,
NULL
,
rowFeSpace
,
colFeSpace
)
{}
};
...
...
AMDiS/src/SystemVector.cc
View file @
9a682f9d
...
...
@@ -17,7 +17,7 @@ namespace AMDiS {
void
SystemVector
::
serialize
(
std
::
ostream
&
out
)
{
int
size
=
vectors
.
getS
ize
();
int
size
=
static_cast
<
int
>
(
vectors
.
s
ize
()
)
;
SerUtil
::
serialize
(
out
,
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
vectors
[
i
]
->
serialize
(
out
);
...
...
@@ -26,7 +26,7 @@ namespace AMDiS {
void
SystemVector
::
deserialize
(
std
::
istream
&
in
)
{
int
size
,
oldSize
=
vectors
.
getS
ize
();
int
size
,
oldSize
=
static_cast
<
int
>
(
vectors
.
s
ize
()
)
;
SerUtil
::
deserialize
(
in
,
size
);
vectors
.
resize
(
size
);
for
(
int
i
=
oldSize
;
i
<
size
;
i
++
)
...
...
@@ -35,4 +35,14 @@ namespace AMDiS {
vectors
[
i
]
->
deserialize
(
in
);
}
vector
<
const
FiniteElemSpace
*>
SystemVector
::
getComponentFeSpaces
()
const
{
vector
<
const
FiniteElemSpace
*>
result
(
vectors
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
size
();
i
++
)
result
[
i
]
=
vectors
[
i
]
->
getFeSpace
();
return
result
;
}
}
AMDiS/src/SystemVector.h
View file @
9a682f9d
...
...
@@ -36,57 +36,50 @@ namespace AMDiS {
public:
/// Constructor.
SystemVector
(
std
::
string
name_
,
std
::
vector
<
FiniteElemSpace
*>
feSpace_
,
std
::
vector
<
const
FiniteElemSpace
*>
feSpace_
,
int
size
)
:
name
(
name_
),
feSpace
(
feSpace_
),
vectors
(
size
)
{
vectors
.
set
(
NULL
);
}
vectors
(
size
,
NULL
)
{}
/// Copy Constructor.
SystemVector
(
const
SystemVector
&
rhs
)
:
name
(
rhs
.
getName
()),
feSpace
(
rhs
.
getFeSpaces
()),
vectors
(
rhs
.
getNumVectors
())
vectors
(
rhs
.
getNumVectors
(),
NULL
)
{
for
(
int
i
=
0
;
i
<
vectors
.
getS
ize
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
s
ize
();
i
++
)
vectors
[
i
]
=
new
DOFVector
<
double
>
(
*
rhs
.
getDOFVector
(
i
));
}
~
SystemVector
()
{
for
(
int
i
=
0
;
i
<
vectors
.
getS
ize
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
s
ize
();
i
++
)
delete
vectors
[
i
];
}
void
createNewDOFVectors
(
std
::
string
name
)
{
for
(
int
i
=
0
;
i
<
vectors
.
getSize
();
i
++
)
vectors
[
i
]
=
new
DOFVector
<
double
>
(
feSpace
[
i
],
"tmp"
);
}
/// Sets \ref vectors[index] = vec.
inline
void
setDOFVector
(
int
index
,
DOFVector
<
double
>
*
vec
)
{
TEST_EXIT_DBG
(
index
<
vectors
.
getSize
())(
"invalid index
\n
"
);
TEST_EXIT_DBG
(
index
<
static_cast
<
int
>
(
vectors
.
size
()))
(
"Invalid index %d!
\n
"
,
index
);
vectors
[
index
]
=
vec
;
}
/// Returns \ref vectors[index].
inline
DOFVector
<
double
>
*
getDOFVector
(
int
index
)
{
TEST_EXIT_DBG
(
index
<
vectors
.
getSize
())(
"invalid index
\n
"
);
TEST_EXIT_DBG
(
index
<
static_cast
<
int
>
(
vectors
.
size
()))
(
"Invalid index %d!
\n
"
,
index
);
return
vectors
[
index
];
}
/// Returns \ref vectors[index].
inline
const
DOFVector
<
double
>
*
getDOFVector
(
int
index
)
const
{
TEST_EXIT_DBG
(
index
<
vectors
.
getSize
())(
"invalid index
\n
"
);
TEST_EXIT_DBG
(
index
<
static_cast
<
int
>
(
vectors
.
size
()))
(
"Invalid index %d!
\n
"
,
index
);
return
vectors
[
index
];
}
...
...
@@ -99,8 +92,7 @@ namespace AMDiS {
inline
int
getUsedSize
()
const
{
int
totalSize
=
0
;
int
size
=
vectors
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
size
();
i
++
)
totalSize
+=
vectors
[
i
]
->
getUsedSize
();
return
totalSize
;
}
...
...
@@ -108,32 +100,32 @@ namespace AMDiS {
/// Returns number of contained vectors.
inline
int
getNumVectors
()
const
{
return
vectors
.
getS
ize
();
return
static_cast
<
int
>
(
vectors
.
s
ize
()
)
;
}
inline
int
getSize
()
const
{
return
vectors
.
getS
ize
();
return
static_cast
<
int
>
(
vectors
.
s
ize
()
)
;
}
/// Returns the fe space for a given component.
inline
FiniteElemSpace
*
getFeSpace
(
int
i
)
const
inline
const
FiniteElemSpace
*
getFeSpace
(
int
i
)
const
{
return
feSpace
[
i
];
}
/// Returns the fe spaces for all components.
inline
std
::
vector
<
FiniteElemSpace
*>
getFeSpaces
()
const
inline
std
::
vector
<
const
FiniteElemSpace
*>
getFeSpaces
()
const
{
return
feSpace
;
}
/** \brief
* Here the system vector is interpreted as one large vector. The given
* is used as a global index which indicates a local vector number and
* a
lo
c
al index
on this vector. The operator returns this
local vector
* at the local index.
*/
vector
<
const
FiniteElemSpace
*>
getComponentFeSpaces
()
const
;
/// Here the system vector is interpreted as one large vector. The given
/// is used as a g
lo
b
al index
which indicates a
local vector
number and
/// a local index on this vector. The operator returns this local vector
/// at the local index.
inline
double
&
operator
[](
int
index
)
{
int
localIndex
=
index
;
...
...
@@ -162,22 +154,20 @@ namespace AMDiS {
/// Sets all entries in all vectors to value.
inline
void
set
(
double
value
)
{
int
size
=
vectors
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
size
();
i
++
)
vectors
[
i
]
->
set
(
value
);
}
inline
void
setCoarsenOperation
(
CoarsenOperation
op
)
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
vectors
.
getS
ize
());
i
++
)
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
vectors
.
s
ize
());
i
++
)
vectors
[
i
]
->
setCoarsenOperation
(
op
);
}
/// Sets all entries in all vectors to value.
inline
SystemVector
&
operator
=
(
double
value
)
{
int
size
=
vectors
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
vectors
.
size
());
i
++
)
(
*
(
vectors
[
i
]))
=
value
;
return
*
this
;
}
...
...
@@ -185,10 +175,11 @@ namespace AMDiS {
/// Assignement operator.
inline
SystemVector
&
operator
=
(
const
SystemVector
&
rhs
)
{
TEST_EXIT_DBG
(
rhs
.
vectors
.
getS
ize
()
==
vectors
.
getS
ize
())(
"
i
nvalied sizes
\n
"
);
int
size
=
vectors
.
getSize
();
for
(
int
i
=
0
;
i
<
s
ize
;
i
++
)
TEST_EXIT_DBG
(
rhs
.
vectors
.
s
ize
()
==
vectors
.
s
ize
())(
"
I
nvalied sizes
!
\n
"
);
for
(
int
i
=
0
;
i
<
s
tatic_cast
<
int
>
(
vectors
.
size
())
;
i
++
)
(
*
(
vectors
[
i
]))
=
(
*
(
rhs
.
getDOFVector
(
i
)));
return
*
this
;
}
...
...
@@ -198,16 +189,15 @@ namespace AMDiS {
void
copy
(
const
SystemVector
&
rhs
)
{
int
size
=
vectors
.
getS
ize
();
TEST_EXIT_DBG
(
size
==
rhs
.
getNumVectors
())(
"
i
nvalid sizes
\n
"
);
int
size
=
static_cast
<
int
>
(
vectors
.
s
ize
()
)
;
TEST_EXIT_DBG
(
size
==
rhs
.
getNumVectors
())(
"
I
nvalid sizes
!
\n
"
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
vectors
[
i
]
->
copy
(
*
(
const_cast
<
SystemVector
&>
(
rhs
).
getDOFVector
(
i
)));
}
void
interpol
(
std
::
vector
<
AbstractFunction
<
double
,
WorldVector
<
double
>
>*>
*
f
)
{
int
size
=
vectors
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
size
();
i
++
)
vectors
[
i
]
->
interpol
((
*
f
)[
i
]);
}
...
...
@@ -219,15 +209,14 @@ namespace AMDiS {
void
print
()
{
int
size
=
vectors
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
size
();
i
++
)
vectors
[
i
]
->
print
();
}
int
calcMemoryUsage
()
{
int
result
=
0
;
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
vectors
.
getS
ize
()
)
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vectors
.
s
ize
();
i
++
)
result
+=
vectors
[
i
]
->
calcMemoryUsage
();
result
+=
sizeof
(
SystemVector
);
...
...
@@ -241,10 +230,10 @@ namespace AMDiS {
std
::
string
name
;
/// Finite element space.
std
::
vector
<
FiniteElemSpace
*>
feSpace
;
std
::
vector
<
const
FiniteElemSpace
*>
feSpace
;
/// Local dof vectors.
V
ector
<
DOFVector
<
double
>*>
vectors
;
std
::
v
ector
<
DOFVector
<
double
>*>
vectors
;
};
...
...
AMDiS/src/parallel/ParallelCoarseSpaceMatVec.cc
View file @
9a682f9d
...
...
@@ -261,7 +261,7 @@ namespace AMDiS {
mpiCommGlobal
.
Allreduce
(
&
sendValue
,
&
recvAllValues
,
1
,
MPI_INT
,
MPI_SUM
);
if
(
recvAllValues
!=
0
||
alwaysCreateNnzStructure
)
{
vector
<
const
FiniteElemSpace
*>
feSpaces
=
getFeSpaces
(
seqMat
);
vector
<
const
FiniteElemSpace
*>
feSpaces
=
get
Component
FeSpaces
(
seqMat
);
interiorMap
->
setComputeMatIndex
(
!
localMatrix
);
interiorMap
->
update
(
feSpaces
);
...
...
AMDiS/src/parallel/PetscSolver.cc
View file @
9a682f9d
...
...
@@ -110,40 +110,4 @@ namespace AMDiS {
VecScatterDestroy
(
&
scatter
);
}
vector
<
const
FiniteElemSpace
*>
PetscSolver
::
getFeSpaces
(
SystemVector
*
vec
)
{
FUNCNAME
(
"PetscSolver::getFeSpaces()"
);
int
nComponents
=
vec
->
getSize
();
vector
<
const
FiniteElemSpace
*>
result
(
nComponents
);