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
Aland, Sebastian
amdis
Commits
27235c55
Commit
27235c55
authored
Apr 20, 2012
by
Thomas Witkowski
Browse files
Parallel type changes.
parent
a8523376
Changes
15
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/AMDiS_fwd.h
View file @
27235c55
...
@@ -97,6 +97,10 @@ namespace AMDiS {
...
@@ -97,6 +97,10 @@ namespace AMDiS {
class
VertexInfo
;
class
VertexInfo
;
class
VertexVector
;
class
VertexVector
;
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
class
FeSpaceDofMap
;
#endif
struct
BoundaryObject
;
struct
BoundaryObject
;
struct
AtomicBoundary
;
struct
AtomicBoundary
;
...
...
AMDiS/src/DOFMatrix.cc
View file @
27235c55
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
#include
"BoundaryManager.h"
#include
"BoundaryManager.h"
#include
"Assembler.h"
#include
"Assembler.h"
#include
"Serializer.h"
#include
"Serializer.h"
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include
"parallel/ParallelDofMapping.h"
#endif
namespace
AMDiS
{
namespace
AMDiS
{
...
@@ -233,11 +236,12 @@ namespace AMDiS {
...
@@ -233,11 +236,12 @@ namespace AMDiS {
if
(
condition
&&
condition
->
isDirichlet
())
{
if
(
condition
&&
condition
->
isDirichlet
())
{
if
(
condition
->
applyBoundaryCondition
())
{
if
(
condition
->
applyBoundaryCondition
())
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if
(
(
*
r
ankDof
s
)[
rowIndices
[
i
]
]
)
if
(
dofMap
->
isR
ankDof
(
rowIndices
[
i
]
)
)
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
#else
#else
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
#endif
#endif
}
}
}
else
{
}
else
{
...
@@ -514,4 +518,10 @@ namespace AMDiS {
...
@@ -514,4 +518,10 @@ namespace AMDiS {
inserter
=
new
inserter_type
(
matrix
,
nnz_per_row
);
inserter
=
new
inserter_type
(
matrix
,
nnz_per_row
);
}
}
void
DOFMatrix
::
setDofMap
(
FeSpaceDofMap
&
m
)
{
dofMap
=
&
m
;
}
}
}
AMDiS/src/DOFMatrix.h
View file @
27235c55
...
@@ -39,6 +39,8 @@
...
@@ -39,6 +39,8 @@
namespace
AMDiS
{
namespace
AMDiS
{
using
namespace
std
;
/** \ingroup DOFAdministration
/** \ingroup DOFAdministration
* \brief
* \brief
* A DOFMatrix is a sparse matrix representation for matrices that work
* A DOFMatrix is a sparse matrix representation for matrices that work
...
@@ -65,18 +67,17 @@ namespace AMDiS {
...
@@ -65,18 +67,17 @@ namespace AMDiS {
/// Symbolic constant for an unused matrix entry
/// Symbolic constant for an unused matrix entry
static
const
int
UNUSED_ENTRY
=
-
1
;
static
const
int
UNUSED_ENTRY
=
-
1
;
/** \brief
/// Symbolic constant for an unused entry which is not followed by any
* Symbolic constant for an unused entry which is not followed by any
/// used entry in this row
* used entry in this row
*/
static
const
int
NO_MORE_ENTRIES
=
-
2
;
static
const
int
NO_MORE_ENTRIES
=
-
2
;
public:
public:
DOFMatrix
();
DOFMatrix
();
/// Constructs a DOFMatrix with name n and the given row and olumn FeSpaces.
/// Constructs a DOFMatrix with name n and the given row and olumn FeSpaces.
DOFMatrix
(
const
FiniteElemSpace
*
rowFeSpace
,
const
FiniteElemSpace
*
colFeSpace
,
DOFMatrix
(
const
FiniteElemSpace
*
rowFeSpace
,
std
::
string
n
=
""
);
const
FiniteElemSpace
*
colFeSpace
,
string
n
=
""
);
/// Copy-Constructor
/// Copy-Constructor
DOFMatrix
(
const
DOFMatrix
&
rhs
);
DOFMatrix
(
const
DOFMatrix
&
rhs
);
...
@@ -102,15 +103,15 @@ namespace AMDiS {
...
@@ -102,15 +103,15 @@ namespace AMDiS {
}
}
// Only to get rid of the abstract functions, I hope they are not used
// Only to get rid of the abstract functions, I hope they are not used
std
::
vector
<
bool
>::
iterator
begin
()
vector
<
bool
>::
iterator
begin
()
{
{
ERROR_EXIT
(
"Shouldn't be used, only fake."
);
std
::
vector
<
bool
>
v
;
ERROR_EXIT
(
"Shouldn't be used, only fake."
);
vector
<
bool
>
v
;
return
v
.
begin
();
return
v
.
begin
();
}
}
std
::
vector
<
bool
>::
iterator
end
()
vector
<
bool
>::
iterator
end
()
{
{
ERROR_EXIT
(
"Shouldn't be used, only fake."
);
std
::
vector
<
bool
>
v
;
ERROR_EXIT
(
"Shouldn't be used, only fake."
);
vector
<
bool
>
v
;
return
v
.
end
();
return
v
.
end
();
}
}
...
@@ -128,7 +129,7 @@ namespace AMDiS {
...
@@ -128,7 +129,7 @@ namespace AMDiS {
}
}
/// DOFMatrix does not need to be compressed before assembling, when using MTL4.
/// DOFMatrix does not need to be compressed before assembling, when using MTL4.
void
compressDOFIndexed
(
int
first
,
int
last
,
std
::
vector
<
DegreeOfFreedom
>
&
newDOF
)
void
compressDOFIndexed
(
int
first
,
int
last
,
vector
<
DegreeOfFreedom
>
&
newDOF
)
{}
{}
/// Implements DOFIndexedBase::freeDOFContent()
/// Implements DOFIndexedBase::freeDOFContent()
...
@@ -152,39 +153,38 @@ namespace AMDiS {
...
@@ -152,39 +153,38 @@ namespace AMDiS {
/// Multiplication with a scalar.
/// Multiplication with a scalar.
void
scal
(
double
s
);
void
scal
(
double
s
);
/** \brief
/// Adds an operator to the DOFMatrix. A factor, that is multipled to the
* Adds an operator to the DOFMatrix. A factor, that is multipled
/// operator, and a multilier factor for the estimator may be also given.
* to the operator, and a multilier factor for the estimator may be
void
addOperator
(
Operator
*
op
,
* also given.
double
*
factor
=
NULL
,
*/
double
*
estFactor
=
NULL
);
void
addOperator
(
Operator
*
op
,
double
*
factor
=
NULL
,
double
*
estFactor
=
NULL
);
inline
std
::
vector
<
double
*>::
iterator
getOperatorFactorBegin
()
inline
vector
<
double
*>::
iterator
getOperatorFactorBegin
()
{
{
return
operatorFactor
.
begin
();
return
operatorFactor
.
begin
();
}
}
inline
std
::
vector
<
double
*>::
iterator
getOperatorFactorEnd
()
inline
vector
<
double
*>::
iterator
getOperatorFactorEnd
()
{
{
return
operatorFactor
.
end
();
return
operatorFactor
.
end
();
}
}
inline
std
::
vector
<
double
*>::
iterator
getOperatorEstFactorBegin
()
inline
vector
<
double
*>::
iterator
getOperatorEstFactorBegin
()
{
{
return
operatorEstFactor
.
begin
();
return
operatorEstFactor
.
begin
();
}
}
inline
std
::
vector
<
double
*>::
iterator
getOperatorEstFactorEnd
()
inline
vector
<
double
*>::
iterator
getOperatorEstFactorEnd
()
{
{
return
operatorEstFactor
.
end
();
return
operatorEstFactor
.
end
();
}
}
inline
std
::
vector
<
Operator
*>::
iterator
getOperatorsBegin
()
inline
vector
<
Operator
*>::
iterator
getOperatorsBegin
()
{
{
return
operators
.
begin
();
return
operators
.
begin
();
}
}
inline
std
::
vector
<
Operator
*>::
iterator
getOperatorsEnd
()
inline
vector
<
Operator
*>::
iterator
getOperatorsEnd
()
{
{
return
operators
.
end
();
return
operators
.
end
();
}
}
...
@@ -237,11 +237,9 @@ namespace AMDiS {
...
@@ -237,11 +237,9 @@ namespace AMDiS {
ElInfo
*
rowElInfo
,
ElInfo
*
rowElInfo
,
ElInfo
*
colElInfo
);
ElInfo
*
colElInfo
);
/* \brief
/// That function must be called after the matrix assembling has been
* That function must be called after the matrix assembling has been finished.
/// finished. This makes it possible to start some cleanup or matrix
* This makes it possible to start some cleanup or matrix data compressing
/// data compressing procedures.
* procedures.
*/
void
finishAssembling
();
void
finishAssembling
();
/** \brief
/** \brief
...
@@ -252,10 +250,8 @@ namespace AMDiS {
...
@@ -252,10 +250,8 @@ namespace AMDiS {
*/
*/
void
startInsertion
(
int
nnz_per_row
=
10
);
void
startInsertion
(
int
nnz_per_row
=
10
);
/** \brief
/// Finishes insertion. For compressed matrix types, this is where the
* Finishes insertion. For compressed matrix types, this is where the
/// compression happens.
* compression happens.
*/
void
finishInsertion
()
void
finishInsertion
()
{
{
FUNCNAME
(
"DOFMatrix::finishInsertion()"
);
FUNCNAME
(
"DOFMatrix::finishInsertion()"
);
...
@@ -266,10 +262,8 @@ namespace AMDiS {
...
@@ -266,10 +262,8 @@ namespace AMDiS {
inserter
=
0
;
inserter
=
0
;
}
}
/** \brief
/// Returns whether restriction should be performed after coarsening
* Returns whether restriction should be performed after coarsening
/// (false by default)
* (false by default)
*/
virtual
bool
coarseRestrict
()
virtual
bool
coarseRestrict
()
{
{
return
false
;
return
false
;
...
@@ -299,17 +293,15 @@ namespace AMDiS {
...
@@ -299,17 +293,15 @@ namespace AMDiS {
return
num_rows
(
matrix
);
return
num_rows
(
matrix
);
}
}
/** \brief
/// Returns the number of used rows (equal to number of used DOFs in
* Returns the number of used rows (equal to number of used DOFs in
/// the row FE space).
* the row FE space).
*/
inline
int
getUsedSize
()
const
inline
int
getUsedSize
()
const
{
{
return
rowFeSpace
->
getAdmin
()
->
getUsedSize
();
return
rowFeSpace
->
getAdmin
()
->
getUsedSize
();
}
}
/// Returns \ref name
/// Returns \ref name
inline
std
::
string
getName
()
const
inline
string
getName
()
const
{
{
return
name
;
return
name
;
}
}
...
@@ -326,10 +318,8 @@ namespace AMDiS {
...
@@ -326,10 +318,8 @@ namespace AMDiS {
/// Changes col at logical indices a,b to c
/// Changes col at logical indices a,b to c
void
changeColOfEntry
(
DegreeOfFreedom
a
,
DegreeOfFreedom
b
,
DegreeOfFreedom
c
);
void
changeColOfEntry
(
DegreeOfFreedom
a
,
DegreeOfFreedom
b
,
DegreeOfFreedom
c
);
/** \brief
/// Creates an entry with logical indices irow, icol if there is no entry
* Creates an entry with logical indices irow, icol if there is no entry
/// yet. Than sign * entry is added to the value at this logical indices
* yet. Than sign * entry is added to the value at this logical indices
*/
void
addSparseDOFEntry
(
double
sign
,
void
addSparseDOFEntry
(
double
sign
,
int
irow
,
int
jcol
,
double
entry
,
int
irow
,
int
jcol
,
double
entry
,
bool
add
=
true
);
bool
add
=
true
);
...
@@ -350,17 +340,17 @@ namespace AMDiS {
...
@@ -350,17 +340,17 @@ namespace AMDiS {
bool
symmetric
();
bool
symmetric
();
inline
std
::
vector
<
Operator
*>&
getOperators
()
inline
vector
<
Operator
*>&
getOperators
()
{
{
return
operators
;
return
operators
;
}
}
inline
std
::
vector
<
double
*>&
getOperatorFactor
()
inline
vector
<
double
*>&
getOperatorFactor
()
{
{
return
operatorFactor
;
return
operatorFactor
;
}
}
inline
std
::
vector
<
double
*>&
getOperatorEstFactor
()
inline
vector
<
double
*>&
getOperatorEstFactor
()
{
{
return
operatorEstFactor
;
return
operatorEstFactor
;
}
}
...
@@ -399,65 +389,53 @@ namespace AMDiS {
...
@@ -399,65 +389,53 @@ namespace AMDiS {
}
}
/// Writes the matrix to an output stream.
/// Writes the matrix to an output stream.
void
serialize
(
std
::
ostream
&
out
);
void
serialize
(
ostream
&
out
);
/// Reads a matrix from an input stream.
/// Reads a matrix from an input stream.
void
deserialize
(
std
::
istream
&
in
);
void
deserialize
(
istream
&
in
);
///
///
int
memsize
();
int
memsize
();
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void
setRankDofs
(
std
::
map
<
DegreeOfFreedom
,
bool
>&
dofmap
)
void
setDofMap
(
FeSpaceDofMap
&
m
);
{
rankDofs
=
&
dofmap
;
}
#endif
#endif
protected:
protected:
/** \brief
/// Pointer to a FiniteElemSpace with information about corresponding row DOFs
* Pointer to a FiniteElemSpace with information about corresponding row DOFs
/// and basis functions
* and basis functions
*/
const
FiniteElemSpace
*
rowFeSpace
;
const
FiniteElemSpace
*
rowFeSpace
;
/** \brief
/// Pointer to a FiniteElemSpace with information about corresponding
* Pointer to a FiniteElemSpace with information about corresponding
/// column DOFs and basis functions
* column DOFs and basis functions
*/
const
FiniteElemSpace
*
colFeSpace
;
const
FiniteElemSpace
*
colFeSpace
;
/// Name of the DOFMatrix
/// Name of the DOFMatrix
std
::
string
name
;
string
name
;
/// Sparse matrix, type is a template parameter by default compressed2D<double>
/// Sparse matrix, type is a template parameter by
/// default compressed2D<double>
base_matrix_type
matrix
;
base_matrix_type
matrix
;
/// Used while mesh traversal
/// Used while mesh traversal
static
DOFMatrix
*
traversePtr
;
static
DOFMatrix
*
traversePtr
;
/** \brief
/// Pointers to all operators of the equation systems. Are used in the
* Pointers to all operators of the equation systems. Are used in the
/// assembling process.
* assembling process.
vector
<
Operator
*>
operators
;
*/
std
::
vector
<
Operator
*>
operators
;
/** \brief
/// Defines for each operator a factor which is used to scal the element
* Defines for each operator a factor which is used to scal the element
/// matrix after the assembling process of the operator.
* matrix after the assembling process of the operator.
vector
<
double
*>
operatorFactor
;
*/
std
::
vector
<
double
*>
operatorFactor
;
///
///
std
::
vector
<
double
*>
operatorEstFactor
;
vector
<
double
*>
operatorEstFactor
;
///
///
BoundaryManager
*
boundaryManager
;
BoundaryManager
*
boundaryManager
;
/** \brief
/// If false, the matrix is a diagonal matrix within a matrix of DOF matrices.
* If false, the matrix is a diagonal matrix within a matrix of DOF matrices.
/// Otherwise the value is true, and the matrix is an off-diagonal matrix.
* Otherwise the value is true, and the matrix is an off-diagonal matrix.
*/
bool
coupleMatrix
;
bool
coupleMatrix
;
/// Temporary variable used in assemble()
/// Temporary variable used in assemble()
...
@@ -470,10 +448,10 @@ namespace AMDiS {
...
@@ -470,10 +448,10 @@ namespace AMDiS {
int
nCol
;
int
nCol
;
/// Maps local row indices of an element to global matrix indices.
/// Maps local row indices of an element to global matrix indices.
std
::
vector
<
DegreeOfFreedom
>
rowIndices
;
vector
<
DegreeOfFreedom
>
rowIndices
;
/// Maps local col indices of an element to global matrix indices.
/// Maps local col indices of an element to global matrix indices.
std
::
vector
<
DegreeOfFreedom
>
colIndices
;
vector
<
DegreeOfFreedom
>
colIndices
;
/* \brief
/* \brief
* A set of row indices. When assembling the DOF matrix, all rows, that
* A set of row indices. When assembling the DOF matrix, all rows, that
...
@@ -492,10 +470,10 @@ namespace AMDiS {
...
@@ -492,10 +470,10 @@ namespace AMDiS {
int
nnzPerRow
;
int
nnzPerRow
;
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
///
Stores for the DOFs of the row FE spaces whether they are owned by
the
///
Is used in parallel computations to check whether specific DOFs in
the
/// rank or not. This is used to ensure that
Dirichlet BC is handled
///
row FE spaces are owned by the
rank or not. This is used to ensure that
/// correctly in parallel computations.
///
Dirichlet BC is handled
correctly in parallel computations.
std
::
map
<
DegreeOfFreedom
,
bool
>
*
rankDofs
;
FeSpaceDofMap
*
dofMap
;
#endif
#endif
/// Inserter object: implemented as pointer, allocated and deallocated as needed
/// Inserter object: implemented as pointer, allocated and deallocated as needed
...
...
AMDiS/src/DOFVector.h
View file @
27235c55
...
@@ -42,9 +42,14 @@
...
@@ -42,9 +42,14 @@
#include
"BasisFunction.h"
#include
"BasisFunction.h"
#include
"FiniteElemSpace.h"
#include
"FiniteElemSpace.h"
#include
"SurfaceQuadrature.h"
#include
"SurfaceQuadrature.h"
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include
"parallel/ParallelDofMapping.h"
#endif
namespace
AMDiS
{
namespace
AMDiS
{
using
namespace
std
;
template
<
typename
T
>
template
<
typename
T
>
class
DOFVectorBase
:
public
DOFIndexed
<
T
>
class
DOFVectorBase
:
public
DOFIndexed
<
T
>
{
{
...
@@ -57,25 +62,21 @@ namespace AMDiS {
...
@@ -57,25 +62,21 @@ namespace AMDiS {
nBasFcts
(
0
)
nBasFcts
(
0
)
{
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
rankDofs
=
NULL
;
dofMap
=
NULL
;
#endif
#endif
}
}
DOFVectorBase
(
const
FiniteElemSpace
*
f
,
std
::
string
n
);
DOFVectorBase
(
const
FiniteElemSpace
*
f
,
string
n
);
virtual
~
DOFVectorBase
();
virtual
~
DOFVectorBase
();
/** \brief
/// For the given element, this function returns an array of all DOFs of
* For the given element, this function returns an array of all DOFs of this
/// this DOFVector that are defined on this element.
* DOFVector that are defined on this element.
*/
virtual
void
getLocalVector
(
const
Element
*
el
,
virtual
void
getLocalVector
(
const
Element
*
el
,
mtl
::
dense_vector
<
T
>&
localVec
)
const
;
mtl
::
dense_vector
<
T
>&
localVec
)
const
;
/** \brief
/// Evaluates the DOF vector at a set of quadrature points defined on the
* Evaluates the DOF vector at a set of quadrature points defined on the
/// given element.
* given element.
*/
void
getVecAtQPs
(
const
ElInfo
*
elInfo
,
void
getVecAtQPs
(
const
ElInfo
*
elInfo
,
const
Quadrature
*
quad
,
const
Quadrature
*
quad
,
const
FastQuadrature
*
quadFast
,
const
FastQuadrature
*
quadFast
,
...
@@ -87,10 +88,8 @@ namespace AMDiS {
...
@@ -87,10 +88,8 @@ namespace AMDiS {
const
FastQuadrature
*
quadFast
,
const
FastQuadrature
*
quadFast
,
mtl
::
dense_vector
<
T
>&
vecAtQPs
)
const
;
mtl
::
dense_vector
<
T
>&
vecAtQPs
)
const
;
/** \brief
/// Evaluates the gradient of a DOF vector at a set of quadrature points
* Evaluates the gradient of a DOF vector at a set of quadrature points defined on the
/// defined on the given element.
* given element.
*/
void
getGrdAtQPs
(
const
ElInfo
*
elInfo
,
void
getGrdAtQPs
(
const
ElInfo
*
elInfo
,
const
Quadrature
*
quad
,
const
Quadrature
*
quad
,
const
FastQuadrature
*
quadFast
,
const
FastQuadrature
*
quadFast
,
...
@@ -102,10 +101,8 @@ namespace AMDiS {
...
@@ -102,10 +101,8 @@ namespace AMDiS {
const
FastQuadrature
*
quadFast
,
const
FastQuadrature
*
quadFast
,
mtl
::
dense_vector
<
typename
GradientType
<
T
>::
type
>
&
grdAtQPs
)
const
;
mtl
::
dense_vector
<
typename
GradientType
<
T
>::
type
>
&
grdAtQPs
)
const
;
/** \brief
/// Evaluates the comp'th component of the derivative of a DOF vector at a
* Evaluates the comp'th component of the derivative of a DOF vector at a set of quadrature points defined on the
/// set of quadrature points defined on the given element.
* given element.
*/
void
getDerivativeAtQPs
(
const
ElInfo
*
elInfo
,
void
getDerivativeAtQPs
(
const
ElInfo
*
elInfo
,
const
Quadrature
*
quad
,
const
Quadrature
*
quad
,
const
FastQuadrature
*
quadFast
,
const
FastQuadrature
*
quadFast
,
...
@@ -119,10 +116,8 @@ namespace AMDiS {
...
@@ -119,10 +116,8 @@ namespace AMDiS {
int
comp
,
int
comp
,
mtl
::
dense_vector
<
T
>
&
derivativeAtQPs
)
const
;
mtl
::
dense_vector
<
T
>
&
derivativeAtQPs
)
const
;
/** \brief
/// Evaluates the jacobian of a DOF vector at a set of quadrature points
* Evaluates the jacobian of a DOF vector at a set of quadrature points defined on the
/// defined on the given element.
* given element.
*/
void
getD2AtQPs
(
const
ElInfo
*
elInfo
,
void
getD2AtQPs
(
const
ElInfo
*
elInfo
,
const
Quadrature
*
quad
,
const
Quadrature
*
quad
,
const
FastQuadrature
*
quadFast
,
const
FastQuadrature
*
quadFast
,
...
@@ -134,10 +129,8 @@ namespace AMDiS {
...
@@ -134,10 +129,8 @@ namespace AMDiS {
return
feSpace
;
return
feSpace
;
}
}
/** \brief
/// Assembles the element vector for the given ellement and adds the
* Assembles the element vector for the given ellement and adds the
/// element matrix to the current DOF vector.
* element matrix to the current DOF vector.
*/
void
assemble
(
T
factor
,
ElInfo
*
elInfo
,
void
assemble
(
T
factor
,
ElInfo
*
elInfo
,
const
BoundaryType
*
bound
,
const
BoundaryType
*
bound
,
Operator
*
op
=
NULL
);
Operator
*
op
=
NULL
);
...
@@ -154,11 +147,9 @@ namespace AMDiS {
...
@@ -154,11 +147,9 @@ namespace AMDiS {
ElInfo
*
elInfo
,
ElInfo
*
elInfo
,