diff --git a/AMDiS/src/BoundaryCondition.h b/AMDiS/src/BoundaryCondition.h index e74d980eff225ab14797e2115b7dd24a33f10f77..d177ef9b5870f8aa909fd2ad6b6bd74e925df2f3 100644 --- a/AMDiS/src/BoundaryCondition.h +++ b/AMDiS/src/BoundaryCondition.h @@ -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. diff --git a/AMDiS/src/ComponentTraverseInfo.h b/AMDiS/src/ComponentTraverseInfo.h index f8f38eba2c73eecd1fa3f43cf41f12a45b82230d..5e55fccf23de619ea3a3ea609f8b6422705aae4d 100644 --- a/AMDiS/src/ComponentTraverseInfo.h +++ b/AMDiS/src/ComponentTraverseInfo.h @@ -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; diff --git a/AMDiS/src/DirichletBC.cc b/AMDiS/src/DirichletBC.cc index f53ca3d1d7e114a5751bb061a2b646438f11575c..face0ddd3ece92c35d86f11a294aeeb2b101cd39 100644 --- a/AMDiS/src/DirichletBC.cc +++ b/AMDiS/src/DirichletBC.cc @@ -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), diff --git a/AMDiS/src/DirichletBC.h b/AMDiS/src/DirichletBC.h index 312bde445999fc784a0e414f3c2317d091c6e554..2babebca00303963fe7cdbb42442a9fd378bdf6d 100644 --- a/AMDiS/src/DirichletBC.h +++ b/AMDiS/src/DirichletBC.h @@ -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. diff --git a/AMDiS/src/MatrixVector.cc b/AMDiS/src/MatrixVector.cc index 361fc0cd1e10599fd8b57a90159034c392190811..7909901ede13f28dd125cc003aa8cc7c976199f7 100644 --- a/AMDiS/src/MatrixVector.cc +++ b/AMDiS/src/MatrixVector.cc @@ -16,9 +16,9 @@ namespace AMDiS { - vector<const FiniteElemSpace*> getFeSpaces(Matrix<DOFMatrix*> &mat) + vector<const FiniteElemSpace*> getComponentFeSpaces(Matrix<DOFMatrix*> &mat) { - FUNCNAME("getFeSpaces()"); + FUNCNAME("getComponentFeSpaces()"); int nComponents = mat.getNumRows(); vector<const FiniteElemSpace*> result(nComponents); diff --git a/AMDiS/src/MatrixVector.h b/AMDiS/src/MatrixVector.h index 9edba99b9def59b87a5b0f8615d95d3c40fa38e1..b8d06ce809b692b8111835e99dd2c86367c2c740 100644 --- a/AMDiS/src/MatrixVector.h +++ b/AMDiS/src/MatrixVector.h @@ -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*> getComponentFeSpaces(Matrix<DOFMatrix*> &mat); } #endif // AMDIS_MATRIXVECTOR_H diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc index 26ef5d8ed17ac2b6e9c261e962ebe79a92d7b777..1fb18b6ab015597d109d3bf6961df3d6c8f898e3 100644 --- a/AMDiS/src/PeriodicBC.cc +++ b/AMDiS/src/PeriodicBC.cc @@ -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) { diff --git a/AMDiS/src/PeriodicBC.h b/AMDiS/src/PeriodicBC.h index 5f83a690b11e2cf95c6f4b7cca9d726cef9096d9..6ab6785d6ce08c3cb0db237e88e42862bbf236fa 100644 --- a/AMDiS/src/PeriodicBC.h +++ b/AMDiS/src/PeriodicBC.h @@ -88,7 +88,7 @@ namespace AMDiS { { public: /// Constructor. - PeriodicBC(BoundaryType type, FiniteElemSpace *rowFeSpace); + PeriodicBC(BoundaryType type, const FiniteElemSpace *rowFeSpace); ~PeriodicBC(); diff --git a/AMDiS/src/ProblemStat.cc b/AMDiS/src/ProblemStat.cc index 8e1787698cb7d3fac96c66378af1c6520164cac5..27fddd4df2cf89280a43d51d1c3e3ddc57ca6fe9 100644 --- a/AMDiS/src/ProblemStat.cc +++ b/AMDiS/src/ProblemStat.cc @@ -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) diff --git a/AMDiS/src/ProblemStat.h b/AMDiS/src/ProblemStat.h index faa4f8cb9fd83f83168a220dc0f2bada525fb8ac..bcd9cae828c5d2fc28bd4f64c3cbc5b34435a162 100644 --- a/AMDiS/src/ProblemStat.h +++ b/AMDiS/src/ProblemStat.h @@ -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; diff --git a/AMDiS/src/RobinBC.cc b/AMDiS/src/RobinBC.cc index fa0f6d94005409a2f62b8c7b2cf0bd463043a1e7..b16423bed2c840ef0979a91d8c46d32f4413310a 100644 --- a/AMDiS/src/RobinBC.cc +++ b/AMDiS/src/RobinBC.cc @@ -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) diff --git a/AMDiS/src/RobinBC.h b/AMDiS/src/RobinBC.h index 4bbbac481b002f3ecbdfd6bb2bda76d3df7ae54d..d2a812179bf1b3e4a982c8c70cb21777cb984097 100644 --- a/AMDiS/src/RobinBC.h +++ b/AMDiS/src/RobinBC.h @@ -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) {} }; diff --git a/AMDiS/src/SystemVector.cc b/AMDiS/src/SystemVector.cc index 9b644920f16fd8eb216991c509ea8a7bcd34c2fc..8399b03785a96c2c2b19268e8a8fcfd67926aeff 100644 --- a/AMDiS/src/SystemVector.cc +++ b/AMDiS/src/SystemVector.cc @@ -17,7 +17,7 @@ namespace AMDiS { void SystemVector::serialize(std::ostream &out) { - int size = vectors.getSize(); + int size = static_cast<int>(vectors.size()); 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.getSize(); + int size, oldSize = static_cast<int>(vectors.size()); 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; + } } diff --git a/AMDiS/src/SystemVector.h b/AMDiS/src/SystemVector.h index 473167777806bbd903571b49411e3bf0fdb78efb..79aa0a4f1a456ec39a1c51bc38b9ff2050a56aba 100644 --- a/AMDiS/src/SystemVector.h +++ b/AMDiS/src/SystemVector.h @@ -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.getSize(); i++) + for (unsigned int i = 0; i < vectors.size(); i++) vectors[i] = new DOFVector<double>(*rhs.getDOFVector(i)); } ~SystemVector() { - for (int i = 0; i < vectors.getSize(); i++) + for (unsigned int i = 0; i < vectors.size(); 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.getSize(); + return static_cast<int>(vectors.size()); } inline int getSize() const { - return vectors.getSize(); + return static_cast<int>(vectors.size()); } /// 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 local 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 global 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.getSize()); i++) + for (int i = 0; i < static_cast<int>(vectors.size()); 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.getSize() == vectors.getSize())("invalied sizes\n"); - int size = vectors.getSize(); - for (int i = 0; i < size; i++) + TEST_EXIT_DBG(rhs.vectors.size() == vectors.size())("Invalied sizes!\n"); + + for (int i = 0; i < static_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.getSize(); - TEST_EXIT_DBG(size == rhs.getNumVectors())("invalid sizes\n"); + int size = static_cast<int>(vectors.size()); + TEST_EXIT_DBG(size == rhs.getNumVectors())("Invalid 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.getSize()); i++) + for (unsigned int i = 0; i < vectors.size(); 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. - Vector<DOFVector<double>*> vectors; + std::vector<DOFVector<double>*> vectors; }; diff --git a/AMDiS/src/parallel/ParallelCoarseSpaceMatVec.cc b/AMDiS/src/parallel/ParallelCoarseSpaceMatVec.cc index 0abb7f7817f296b9c9a5add072a6b6820bf2780b..f65ada0b5459dacb6293c34fad9d30db79ece32b 100644 --- a/AMDiS/src/parallel/ParallelCoarseSpaceMatVec.cc +++ b/AMDiS/src/parallel/ParallelCoarseSpaceMatVec.cc @@ -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 = getComponentFeSpaces(seqMat); interiorMap->setComputeMatIndex(!localMatrix); interiorMap->update(feSpaces); diff --git a/AMDiS/src/parallel/PetscSolver.cc b/AMDiS/src/parallel/PetscSolver.cc index 9b5a384801316ae11112d9a08fbd4f3b46fc9514..044f7dfb1ad32d81c5d6e81995936b98eaff3889 100644 --- a/AMDiS/src/parallel/PetscSolver.cc +++ b/AMDiS/src/parallel/PetscSolver.cc @@ -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); - - for (int i = 0; i < nComponents; i++) - result[i] = vec->getFeSpace(i); - -#if (DEBUG != 0) - // === In debug mode, we test if all FE spaces of the matrix are also === - // === considered by the mesh distributor. === - checkFeSpaces(result); -#endif - - return result; - } - - - void PetscSolver::checkFeSpaces(vector<const FiniteElemSpace*>& feSpaces) - { - FUNCNAME("PetscSolver::checkFeSpaces()"); - - for (unsigned int i = 0; i < feSpaces.size(); i++) { - bool found = false; - for (unsigned int j = 0; j < meshDistributor->getFeSpaces().size(); j++) - if (feSpaces[i] == meshDistributor->getFeSpace(j)) { - found = true; - break; - } - TEST_EXIT(found)("FE spaces not found in mesh distributor!\n"); - } - } - } diff --git a/AMDiS/src/parallel/PetscSolver.h b/AMDiS/src/parallel/PetscSolver.h index b745df179422f17bae48787bccfdef33879761e7..27b0214754f2c718daa9a68418d141ccc34d5a9c 100644 --- a/AMDiS/src/parallel/PetscSolver.h +++ b/AMDiS/src/parallel/PetscSolver.h @@ -241,12 +241,6 @@ namespace AMDiS { void copyVec(Vec& originVec, Vec& destVec, vector<int>& originIndex, vector<int>& destIndex); - /// Checks if all given FE spaces are handled by the mesh distributor. - void checkFeSpaces(vector<const FiniteElemSpace*>& feSpaces); - - /// Returns a vector with the FE spaces of all components of a system vector. - vector<const FiniteElemSpace*> getFeSpaces(SystemVector *vec); - protected: MeshDistributor *meshDistributor; diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc index e5b21db5cd7e7bdb3bae1908d79fbe5d9114e7bb..e788279e45b78aaab01b61d5bc514143bad88698 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.cc +++ b/AMDiS/src/parallel/PetscSolverFeti.cc @@ -1265,7 +1265,7 @@ namespace AMDiS { // === Create scatter to get solutions of all primal nodes that are === // === contained in rank's domain. === - vector<const FiniteElemSpace*> feSpaces = getFeSpaces(&vec); + vector<const FiniteElemSpace*> feSpaces = vec.getComponentFeSpaces(); vector<PetscInt> globalIsIndex, localIsIndex; globalIsIndex.reserve(primalDofMap.getLocalDofs()); @@ -1352,7 +1352,7 @@ namespace AMDiS { // === Create all sets and indices. === - vector<const FiniteElemSpace*> feSpaces = AMDiS::getFeSpaces(*mat); + vector<const FiniteElemSpace*> feSpaces = AMDiS::getComponentFeSpaces(*mat); initialize(feSpaces); diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc index ceb79b88c264cee443131aed82e9d5c5f9e5bf2d..ef8f7115bdc0e7e82b0b7da273d31989de77b281 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc @@ -68,11 +68,6 @@ namespace AMDiS { MSG(" nz unneeded: %d\n", static_cast<int>(matInfo.nz_unneeded)); } - // === Remove Dirichlet BC DOFs. === - - // removeDirichletBcDofs(mat); - - // === Init PETSc solver. === KSPCreate(mpiCommGlobal, &kspInterior); @@ -114,7 +109,7 @@ namespace AMDiS { TEST_EXIT_DBG(coarseSpaceMap.size() == seqMat->getSize()) ("Wrong sizes %d %d\n", coarseSpaceMap.size(), seqMat->getSize()); - vector<const FiniteElemSpace*> feSpaces = AMDiS::getFeSpaces(*seqMat); + vector<const FiniteElemSpace*> feSpaces = AMDiS::getComponentFeSpaces(*seqMat); int nRowsRankInterior = interiorMap->getRankDofs(); int nRowsOverallInterior = interiorMap->getOverallDofs(); @@ -748,16 +743,4 @@ namespace AMDiS { } } - - void PetscSolverGlobalMatrix::removeDirichletBcDofs(Matrix<DOFMatrix*> *mat) - { - FUNCNAME("PetscSolverGlobalMatrix::removeDirichletBcDofs()"); - } - - - void PetscSolverGlobalMatrix::removeDirichletBcDofs(SystemVector *vec) - { - FUNCNAME("PetscSolverGlobalMatrix::removeDirichletBcDofs()"); - } - } diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h index de602bef0c24d7363cdaf571c20338928ac38e1c..b77617856bee4f196a0ed908cd2f14a2126e5c3a 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h @@ -79,10 +79,6 @@ namespace AMDiS { DOFVector<double>* vec, int nRowVec, bool rankOnly = false); - void removeDirichletBcDofs(Matrix<DOFMatrix*> *mat); - - void removeDirichletBcDofs(SystemVector *vec); - inline void setDofVector(Vec vecInterior, DOFVector<double>* vec, int nRowVec, bool rankOnly = false)