Liebe Gitlab-Nutzerin, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit 9a682f9d authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Modified some files to make use of const FiniteElemSpace pointers, where this is possible.

parent 0d0838bd
...@@ -80,22 +80,18 @@ namespace AMDiS { ...@@ -80,22 +80,18 @@ namespace AMDiS {
/// Destructor. /// Destructor.
virtual ~BoundaryCondition() {} virtual ~BoundaryCondition() {}
/** \brief /// Adds the local boundary condition for elInfo to object.
* Adds the local boundary condition for elInfo to object. /// The dofIndices and localBound as well as nBasFcts are determined by
* The dofIndices and localBound as well as nBasFcts are determined by // the calling BoundaryManager.
* the calling BoundaryManager.
*/
virtual void fillBoundaryCondition(DOFMatrix *matrix, virtual void fillBoundaryCondition(DOFMatrix *matrix,
ElInfo *elInfo, ElInfo *elInfo,
const DegreeOfFreedom *dofIndices, const DegreeOfFreedom *dofIndices,
const BoundaryType *localBound, const BoundaryType *localBound,
int nBasFcts) {} int nBasFcts) {}
/** \brief /// Adds the local boundary condition for elInfo to vector.
* Adds the local boundary condition for elInfo to vector. /// The dofIndices and localBound as well as nBasFcts are determined by
* The dofIndices and localBound as well as nBasFcts are determined by /// the calling BoundaryManager.
* the calling BoundaryManager.
*/
virtual void fillBoundaryCondition(DOFVectorBase<double> *vector, virtual void fillBoundaryCondition(DOFVectorBase<double> *vector,
ElInfo *elInfo, ElInfo *elInfo,
const DegreeOfFreedom *dofIndices, const DegreeOfFreedom *dofIndices,
...@@ -110,10 +106,8 @@ namespace AMDiS { ...@@ -110,10 +106,8 @@ namespace AMDiS {
return 0.0; return 0.0;
} }
/** \brief /// Returns whether the condition must be treated as Dirichlet condition
* Returns whether the condition must be treated as Dirichlet condition /// while assemblage.
* while assemblage.
*/
virtual bool isDirichlet() virtual bool isDirichlet()
{ {
return false; return false;
...@@ -125,25 +119,21 @@ namespace AMDiS { ...@@ -125,25 +119,21 @@ namespace AMDiS {
return false; return false;
} }
/** \brief /// In some situations it may be required to set Dirichlet boundary
* In some situations it may be required to set Dirichlet boundary conditions, /// conditions, but not to apply them to the matrix. This is for example the
* but not to apply them to the matrix. This is for example the case, if the /// case, if the boundary condition is set to a couple matrix. Then, the
* boundary condition is set to a couple matrix. Then, the boundary conditions /// boundary conditions must be applied to the couple matrix, but they are
* must be applied to the couple matrix, but they are set to all matrices in this /// set to all matrices in this row (to ensure that there are no other
* row (to ensure that there are no other element entries in the Dirichlet boundary /// element entries in the Dirichlet boundary condition rows).
* condition rows).
*/
virtual bool applyBoundaryCondition() virtual bool applyBoundaryCondition()
{ {
return true; return true;
} }
protected: protected:
/** \brief /// Speciefies for which parts of the boundary the condition holds.
* Speciefies for which parts of the boundary the condition holds. /// This id corresponds to the boundary numbers spcified in the
* This id corresponds to the boundary numbers spcified in the /// macro file.
* macro file.
*/
BoundaryType boundaryType; BoundaryType boundaryType;
/// FiniteElemSpace for this BoundaryCondition. /// FiniteElemSpace for this BoundaryCondition.
......
...@@ -38,7 +38,7 @@ namespace AMDiS { ...@@ -38,7 +38,7 @@ namespace AMDiS {
status(0) status(0)
{} {}
void setFeSpace(FiniteElemSpace *row, FiniteElemSpace *col = NULL) void setFeSpace(const FiniteElemSpace *row, const FiniteElemSpace *col = NULL)
{ {
rowFeSpace = row; rowFeSpace = row;
colFeSpace = col; colFeSpace = col;
...@@ -66,12 +66,12 @@ namespace AMDiS { ...@@ -66,12 +66,12 @@ namespace AMDiS {
return auxFeSpaces.size(); return auxFeSpaces.size();
} }
FiniteElemSpace *getRowFeSpace() const FiniteElemSpace *getRowFeSpace()
{ {
return rowFeSpace; return rowFeSpace;
} }
FiniteElemSpace *getColFeSpace() const FiniteElemSpace *getColFeSpace()
{ {
return colFeSpace; return colFeSpace;
} }
...@@ -94,9 +94,9 @@ namespace AMDiS { ...@@ -94,9 +94,9 @@ namespace AMDiS {
} }
protected: protected:
FiniteElemSpace *rowFeSpace; const FiniteElemSpace *rowFeSpace;
FiniteElemSpace *colFeSpace; const FiniteElemSpace *colFeSpace;
std::set<const FiniteElemSpace*> auxFeSpaces; std::set<const FiniteElemSpace*> auxFeSpaces;
......
...@@ -20,8 +20,8 @@ namespace AMDiS { ...@@ -20,8 +20,8 @@ namespace AMDiS {
DirichletBC::DirichletBC(BoundaryType type, DirichletBC::DirichletBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> > *fct, AbstractFunction<double, WorldVector<double> > *fct,
FiniteElemSpace *rowFeSpace, const FiniteElemSpace *rowFeSpace,
FiniteElemSpace *colFeSpace, const FiniteElemSpace *colFeSpace,
bool apply) bool apply)
: BoundaryCondition(type, rowFeSpace, colFeSpace), : BoundaryCondition(type, rowFeSpace, colFeSpace),
f(fct), f(fct),
......
...@@ -45,8 +45,8 @@ namespace AMDiS { ...@@ -45,8 +45,8 @@ namespace AMDiS {
/// Constructor. /// Constructor.
DirichletBC(BoundaryType type, DirichletBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> > *fct, AbstractFunction<double, WorldVector<double> > *fct,
FiniteElemSpace *rowFeSpace, const FiniteElemSpace *rowFeSpace,
FiniteElemSpace *colFeSpace = NULL, const FiniteElemSpace *colFeSpace = NULL,
bool apply = true); bool apply = true);
/// Constructor. /// Constructor.
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
namespace AMDiS { namespace AMDiS {
vector<const FiniteElemSpace*> getFeSpaces(Matrix<DOFMatrix*> &mat) vector<const FiniteElemSpace*> getComponentFeSpaces(Matrix<DOFMatrix*> &mat)
{ {
FUNCNAME("getFeSpaces()"); FUNCNAME("getComponentFeSpaces()");
int nComponents = mat.getNumRows(); int nComponents = mat.getNumRows();
vector<const FiniteElemSpace*> result(nComponents); vector<const FiniteElemSpace*> result(nComponents);
......
...@@ -521,7 +521,7 @@ namespace AMDiS { ...@@ -521,7 +521,7 @@ namespace AMDiS {
/// Returns a vector with the FE spaces of each row in the matrix. Thus, the /// 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. /// resulting vector may contain the same FE space multiple times.
vector<const FiniteElemSpace*> getFeSpaces(Matrix<DOFMatrix*> &mat); vector<const FiniteElemSpace*> getComponentFeSpaces(Matrix<DOFMatrix*> &mat);
} }
#endif // AMDIS_MATRIXVECTOR_H #endif // AMDIS_MATRIXVECTOR_H
...@@ -97,7 +97,7 @@ namespace AMDiS { ...@@ -97,7 +97,7 @@ namespace AMDiS {
} }
PeriodicBC::PeriodicBC(BoundaryType type, FiniteElemSpace *rowSpace) PeriodicBC::PeriodicBC(BoundaryType type, const FiniteElemSpace *rowSpace)
: BoundaryCondition(type, rowSpace, NULL), : BoundaryCondition(type, rowSpace, NULL),
masterMatrix(NULL) masterMatrix(NULL)
{ {
......
...@@ -88,7 +88,7 @@ namespace AMDiS { ...@@ -88,7 +88,7 @@ namespace AMDiS {
{ {
public: public:
/// Constructor. /// Constructor.
PeriodicBC(BoundaryType type, FiniteElemSpace *rowFeSpace); PeriodicBC(BoundaryType type, const FiniteElemSpace *rowFeSpace);
~PeriodicBC(); ~PeriodicBC();
......
...@@ -1586,9 +1586,7 @@ namespace AMDiS { ...@@ -1586,9 +1586,7 @@ namespace AMDiS {
FUNCNAME("ProblemStat::addPeriodicBC()"); FUNCNAME("ProblemStat::addPeriodicBC()");
boundaryConditionSet = true; boundaryConditionSet = true;
PeriodicBC *periodic = new PeriodicBC(type, componentSpaces[row]);
FiniteElemSpace *feSpace = componentSpaces[row];
PeriodicBC *periodic = new PeriodicBC(type, feSpace);
if (systemMatrix && (*systemMatrix)[row][col]) if (systemMatrix && (*systemMatrix)[row][col])
(*systemMatrix)[row][col]->getBoundaryManager()->addBoundaryCondition(periodic); (*systemMatrix)[row][col]->getBoundaryManager()->addBoundaryCondition(periodic);
...@@ -1628,7 +1626,7 @@ namespace AMDiS { ...@@ -1628,7 +1626,7 @@ namespace AMDiS {
} }
void ProblemStatSeq::assembleOnOneMesh(FiniteElemSpace *feSpace, void ProblemStatSeq::assembleOnOneMesh(const FiniteElemSpace *feSpace,
Flag assembleFlag, Flag assembleFlag,
DOFMatrix *matrix, DOFMatrix *matrix,
DOFVector<double> *vector) DOFVector<double> *vector)
......
...@@ -256,7 +256,7 @@ namespace AMDiS { ...@@ -256,7 +256,7 @@ namespace AMDiS {
/// This function assembles a DOFMatrix and a DOFVector for the case, /// This function assembles a DOFMatrix and a DOFVector for the case,
/// the meshes from row and col FE-space are equal. /// the meshes from row and col FE-space are equal.
void assembleOnOneMesh(FiniteElemSpace *feSpace, void assembleOnOneMesh(const FiniteElemSpace *feSpace,
Flag assembleFlag, Flag assembleFlag,
DOFMatrix *matrix, DOFVector<double> *vector); DOFMatrix *matrix, DOFVector<double> *vector);
...@@ -321,7 +321,7 @@ namespace AMDiS { ...@@ -321,7 +321,7 @@ namespace AMDiS {
} }
/// Returns \ref feSpace_. /// Returns \ref feSpace_.
inline FiniteElemSpace* getFeSpace(int comp = 0) inline const FiniteElemSpace* getFeSpace(int comp = 0)
{ {
FUNCNAME("ProblemStatSeq::getFeSpace()"); FUNCNAME("ProblemStatSeq::getFeSpace()");
TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0) TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
...@@ -330,13 +330,13 @@ namespace AMDiS { ...@@ -330,13 +330,13 @@ namespace AMDiS {
} }
/// Returns \ref feSpaces. /// Returns \ref feSpaces.
inline vector<FiniteElemSpace*> getFeSpaces() inline vector<const FiniteElemSpace*> getFeSpaces()
{ {
return feSpaces; return feSpaces;
} }
/// Returns \ref componentSpaces; /// Returns \ref componentSpaces;
inline vector<FiniteElemSpace*> getComponentFeSpaces() inline vector<const FiniteElemSpace*> getComponentFeSpaces()
{ {
return componentSpaces; return componentSpaces;
} }
...@@ -428,12 +428,12 @@ namespace AMDiS { ...@@ -428,12 +428,12 @@ namespace AMDiS {
} }
/// Sets the FE space for the given component. /// 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; feSpaces[comp] = feSpace;
} }
void setComponentSpace(int comp, FiniteElemSpace *feSpace) void setComponentSpace(int comp, const FiniteElemSpace *feSpace)
{ {
if (static_cast<int>(componentSpaces.size()) < nComponents) if (static_cast<int>(componentSpaces.size()) < nComponents)
componentSpaces.resize(nComponents); componentSpaces.resize(nComponents);
...@@ -565,13 +565,13 @@ namespace AMDiS { ...@@ -565,13 +565,13 @@ namespace AMDiS {
int nMeshes; int nMeshes;
/// FE spaces of this problem. /// FE spaces of this problem.
vector<FiniteElemSpace*> feSpaces; vector<const FiniteElemSpace*> feSpaces;
/// Meshes of this problem. /// Meshes of this problem.
vector<Mesh*> meshes; vector<Mesh*> meshes;
/// Pointer to the fe spaces for the different problem components /// 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 /// Pointer to the meshes for the different problem components
vector<Mesh*> componentMeshes; vector<Mesh*> componentMeshes;
......
...@@ -24,8 +24,8 @@ namespace AMDiS { ...@@ -24,8 +24,8 @@ namespace AMDiS {
RobinBC::RobinBC(BoundaryType type, RobinBC::RobinBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> > *j, AbstractFunction<double, WorldVector<double> > *j,
AbstractFunction<double, WorldVector<double> > *alpha, AbstractFunction<double, WorldVector<double> > *alpha,
FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *rowFeSpace_,
FiniteElemSpace *colFeSpace_) const FiniteElemSpace *colFeSpace_)
: BoundaryCondition(type, rowFeSpace_, colFeSpace_), : BoundaryCondition(type, rowFeSpace_, colFeSpace_),
neumannOperators(NULL), neumannOperators(NULL),
robinOperators(NULL) robinOperators(NULL)
...@@ -75,8 +75,8 @@ namespace AMDiS { ...@@ -75,8 +75,8 @@ namespace AMDiS {
RobinBC::RobinBC(BoundaryType type, RobinBC::RobinBC(BoundaryType type,
DOFVectorBase<double> *j, DOFVectorBase<double> *j,
DOFVectorBase<double> *alpha, DOFVectorBase<double> *alpha,
FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *rowFeSpace_,
FiniteElemSpace *colFeSpace_) const FiniteElemSpace *colFeSpace_)
: BoundaryCondition(type, rowFeSpace_, colFeSpace_), : BoundaryCondition(type, rowFeSpace_, colFeSpace_),
neumannOperators(NULL), neumannOperators(NULL),
robinOperators(NULL) robinOperators(NULL)
...@@ -125,8 +125,8 @@ namespace AMDiS { ...@@ -125,8 +125,8 @@ namespace AMDiS {
RobinBC::RobinBC(BoundaryType type, RobinBC::RobinBC(BoundaryType type,
Operator* jOp, Operator* alphaOp, Operator* jOp, Operator* alphaOp,
FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *rowFeSpace_,
FiniteElemSpace *colFeSpace_) const FiniteElemSpace *colFeSpace_)
: BoundaryCondition(type, rowFeSpace_, colFeSpace_), : BoundaryCondition(type, rowFeSpace_, colFeSpace_),
neumannOperators(NULL), neumannOperators(NULL),
robinOperators(NULL) robinOperators(NULL)
......
...@@ -45,21 +45,21 @@ namespace AMDiS { ...@@ -45,21 +45,21 @@ namespace AMDiS {
RobinBC(BoundaryType type, RobinBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> > *j, AbstractFunction<double, WorldVector<double> > *j,
AbstractFunction<double, WorldVector<double> > *alpha, AbstractFunction<double, WorldVector<double> > *alpha,
FiniteElemSpace *rowFeSpace, const FiniteElemSpace *rowFeSpace,
FiniteElemSpace *colFeSpace = NULL); const FiniteElemSpace *colFeSpace = NULL);
/// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as DOFVectors. /// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as DOFVectors.
RobinBC(BoundaryType type, RobinBC(BoundaryType type,
DOFVectorBase<double> *j, DOFVectorBase<double> *j,
DOFVectorBase<double> *alpha, DOFVectorBase<double> *alpha,
FiniteElemSpace *rowFeSpace, const FiniteElemSpace *rowFeSpace,
FiniteElemSpace *colFeSpace = NULL); const FiniteElemSpace *colFeSpace = NULL);
/// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as Operator objects. /// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as Operator objects.
RobinBC(BoundaryType type, RobinBC(BoundaryType type,
Operator* jOp, Operator* alphaOp, Operator* jOp, Operator* alphaOp,
FiniteElemSpace *rowFeSpace, const FiniteElemSpace *rowFeSpace,
FiniteElemSpace *colFeSpace = NULL); const FiniteElemSpace *colFeSpace = NULL);
/// Implements BoundaryCondition::fillBoundaryCondition(); /// Implements BoundaryCondition::fillBoundaryCondition();
virtual void fillBoundaryCondition(DOFMatrix* matrix, virtual void fillBoundaryCondition(DOFMatrix* matrix,
...@@ -96,15 +96,15 @@ namespace AMDiS { ...@@ -96,15 +96,15 @@ namespace AMDiS {
public: public:
NeumannBC(BoundaryType type, NeumannBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> > *j, AbstractFunction<double, WorldVector<double> > *j,
FiniteElemSpace *rowFeSpace, const FiniteElemSpace *rowFeSpace,
FiniteElemSpace *colFeSpace = NULL) const FiniteElemSpace *colFeSpace = NULL)
: RobinBC(type, j, NULL, rowFeSpace, colFeSpace) : RobinBC(type, j, NULL, rowFeSpace, colFeSpace)
{} {}
NeumannBC(BoundaryType type, NeumannBC(BoundaryType type,
DOFVectorBase<double> *j, DOFVectorBase<double> *j,
FiniteElemSpace *rowFeSpace, const FiniteElemSpace *rowFeSpace,
FiniteElemSpace *colFeSpace = NULL) const FiniteElemSpace *colFeSpace = NULL)
: RobinBC(type, j, NULL, rowFeSpace, colFeSpace) : RobinBC(type, j, NULL, rowFeSpace, colFeSpace)
{} {}
}; };
......
...@@ -17,7 +17,7 @@ namespace AMDiS { ...@@ -17,7 +17,7 @@ namespace AMDiS {
void SystemVector::serialize(std::ostream &out) void SystemVector::serialize(std::ostream &out)
{ {
int size = vectors.getSize(); int size = static_cast<int>(vectors.size());
SerUtil::serialize(out, size); SerUtil::serialize(out, size);
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
vectors[i]->serialize(out); vectors[i]->serialize(out);
...@@ -26,7 +26,7 @@ namespace AMDiS { ...@@ -26,7 +26,7 @@ namespace AMDiS {
void SystemVector::deserialize(std::istream &in) void SystemVector::deserialize(std::istream &in)
{ {
int size, oldSize = vectors.getSize(); int size, oldSize = static_cast<int>(vectors.size());
SerUtil::deserialize(in, size); SerUtil::deserialize(in, size);
vectors.resize(size); vectors.resize(size);
for (int i = oldSize; i < size; i++) for (int i = oldSize; i < size; i++)
...@@ -35,4 +35,14 @@ namespace AMDiS { ...@@ -35,4 +35,14 @@ namespace AMDiS {
vectors[i]->deserialize(in); 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;
}
} }
...@@ -36,57 +36,50 @@ namespace AMDiS { ...@@ -36,57 +36,50 @@ namespace AMDiS {
public: public:
/// Constructor. /// Constructor.
SystemVector(std::string name_, SystemVector(std::string name_,
std::vector<FiniteElemSpace*> feSpace_, std::vector<const FiniteElemSpace*> feSpace_,
int size) int size)
: name(name_), : name(name_),
feSpace(feSpace_), feSpace(feSpace_),
vectors(size) vectors(size, NULL)
{}
{
vectors.set(NULL);
}
/// Copy Constructor. /// Copy Constructor.
SystemVector(const SystemVector& rhs) SystemVector(const SystemVector& rhs)
: name(rhs.getName()), : name(rhs.getName()),
feSpace(rhs.getFeSpaces()), feSpace(rhs.getFeSpaces()),
vectors(rhs.getNumVectors()) vectors(rhs.getNumVectors(), NULL)
{ {
for (int i = 0; i < vectors.getSize(); i++) for (unsigned int i = 0; i < vectors.size(); i++)
vectors[i] = new DOFVector<double>(*rhs.getDOFVector(i)); vectors[i] = new DOFVector<double>(*rhs.getDOFVector(i));
} }
~SystemVector() ~SystemVector()
{ {
for (int i = 0; i < vectors.getSize(); i++) for (unsigned int i = 0; i < vectors.size(); i++)
delete vectors[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. /// Sets \ref vectors[index] = vec.
inline void setDOFVector(int index, DOFVector<double> *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; vectors[index] = vec;
} }
/// Returns \ref vectors[index]. /// Returns \ref vectors[index].
inline DOFVector<double> *getDOFVector(int index) inline DOFVector<double> *getDOFVector(int index)
{ {
TEST_EXIT_DBG(index < vectors.getSize())("invalid index\n"); TEST_EXIT_DBG(index < static_cast<