Commit c520ca87 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Work on pdd and some other small code refactorings.

parent 073ad4f8
...@@ -44,7 +44,7 @@ available_tags=" CXX F77" ...@@ -44,7 +44,7 @@ available_tags=" CXX F77"
# ### BEGIN LIBTOOL CONFIG # ### BEGIN LIBTOOL CONFIG
# Libtool was configured on host p1d062: # Libtool was configured on host p2q004:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` ...@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
# End: # End:
# ### BEGIN LIBTOOL TAG CONFIG: CXX # ### BEGIN LIBTOOL TAG CONFIG: CXX
# Libtool was configured on host p1d062: # Libtool was configured on host p2q004:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -7065,7 +7065,7 @@ include_expsyms="" ...@@ -7065,7 +7065,7 @@ include_expsyms=""
# ### BEGIN LIBTOOL TAG CONFIG: F77 # ### BEGIN LIBTOOL TAG CONFIG: F77
# Libtool was configured on host p1d062: # Libtool was configured on host p2q004:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
......
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
#include "SystemVector.h" #include "SystemVector.h"
#include "TecPlotWriter.h" #include "TecPlotWriter.h"
#include "Tetrahedron.h" #include "Tetrahedron.h"
#include "TimedObject.h"
#include "Traverse.h" #include "Traverse.h"
#include "Triangle.h" #include "Triangle.h"
#include "ValueWriter.h" #include "ValueWriter.h"
......
...@@ -213,7 +213,7 @@ namespace AMDiS { ...@@ -213,7 +213,7 @@ namespace AMDiS {
/// Sets \ref firstHole /// Sets \ref firstHole
inline void setFirstHole(int i) inline void setFirstHole(int i)
{ {
TEST_EXIT_DBG(!dofFree[i])("There is no hole!\n"); TEST_EXIT_DBG(dofFree[i])("There is no hole!\n");
firstHole = i; firstHole = i;
} }
......
...@@ -216,7 +216,8 @@ namespace AMDiS { ...@@ -216,7 +216,8 @@ namespace AMDiS {
applyDBCs.insert(static_cast<int>(row)); applyDBCs.insert(static_cast<int>(row));
#endif #endif
} }
} else } else {
for (int j = 0; j < nCol; j++) { // for all columns for (int j = 0; j < nCol; j++) { // for all columns
DegreeOfFreedom col = colIndices[j]; DegreeOfFreedom col = colIndices[j];
double entry = elMat[i][j]; double entry = elMat[i][j];
...@@ -224,8 +225,9 @@ namespace AMDiS { ...@@ -224,8 +225,9 @@ namespace AMDiS {
if (add) if (add)
ins[row][col] += sign * entry; ins[row][col] += sign * entry;
else else
ins[row][col] = sign * entry; ins[row][col] = sign * entry;
} }
}
} }
} }
...@@ -250,18 +252,6 @@ namespace AMDiS { ...@@ -250,18 +252,6 @@ namespace AMDiS {
(*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0); (*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0);
addElementMatrix(factor, elementMatrix, bound, elInfo, NULL); addElementMatrix(factor, elementMatrix, bound, elInfo, NULL);
// if (MPI::COMM_WORLD.Get_rank() == 0 && elInfo->getElement()->getIndex() == 53) {
// std::cout << elementMatrix << std::endl;
// rowFESpace->getBasisFcts()->getLocalIndicesVec(elInfo->getElement(),
// rowFESpace->getAdmin(),
// &rowIndices);
// rowIndices.print();
// print();
// }
} }
void DOFMatrix::assemble(double factor, ElInfo *elInfo, const BoundaryType *bound, void DOFMatrix::assemble(double factor, ElInfo *elInfo, const BoundaryType *bound,
......
This diff is collapsed.
...@@ -130,6 +130,18 @@ namespace AMDiS { ...@@ -130,6 +130,18 @@ namespace AMDiS {
/// Removes all macro elements from the mesh that are not part of ranks partition. /// Removes all macro elements from the mesh that are not part of ranks partition.
void removeMacroElements(); void removeMacroElements();
/** \brief
* Creates from a macro mesh a correct local and global DOF index numbering.
*
* @param[out] rankDOFs Returns all DOFs from the macro mesh, which are owned
* by the rank after partitioning the macro mesh.
* @param[out] boundaryDOFs Returns all DOFs from the macro mesh, which lies at
* an interior boundary of the rank. This object maps
* each such DOF to the rank that owns this DOF.
* @param[out] nRankDOFs Number of DOFs owned by rank.
* @param[out] nOverallDOFs Number of all DOFs in macro mesh.
*/
void createLocalGlobalNumbering(std::vector<const DegreeOfFreedom*>& rankDOFs, void createLocalGlobalNumbering(std::vector<const DegreeOfFreedom*>& rankDOFs,
std::map<const DegreeOfFreedom*, int>& boundaryDOFs, std::map<const DegreeOfFreedom*, int>& boundaryDOFs,
int& nRankDOFs, int& nRankDOFs,
...@@ -138,8 +150,7 @@ namespace AMDiS { ...@@ -138,8 +150,7 @@ namespace AMDiS {
void updateLocalGlobalNumbering(int& nRankDOFs, int& nOverallDOFs); void updateLocalGlobalNumbering(int& nRankDOFs, int& nOverallDOFs);
void addAllDOFs(Element *el, int ithEdge, void addAllDOFs(Element *el, int ithEdge,
std::vector<const DegreeOfFreedom*>& dofs, std::vector<const DegreeOfFreedom*>& dofs);
bool addVertices = true);
/** \brief /** \brief
* This function traverses the whole mesh, i.e. before it is really partitioned, * This function traverses the whole mesh, i.e. before it is really partitioned,
...@@ -220,6 +231,12 @@ namespace AMDiS { ...@@ -220,6 +231,12 @@ namespace AMDiS {
/// Number of DOFs in the rank mesh. /// Number of DOFs in the rank mesh.
int nRankDOFs; int nRankDOFs;
/** \brief
* Set of all interior boundary DOFs in ranks partition. The object maps to
* each such DOF to the number of the rank that owns this DOF.
*/
std::map<const DegreeOfFreedom*, int> boundaryDOFs;
/** \brief /** \brief
* Defines the interior boundaries of the domain that result from partitioning * Defines the interior boundaries of the domain that result from partitioning
* the whole mesh. Contains only the boundaries, which are owned by the rank, i.e., * the whole mesh. Contains only the boundaries, which are owned by the rank, i.e.,
...@@ -240,13 +257,13 @@ namespace AMDiS { ...@@ -240,13 +257,13 @@ namespace AMDiS {
* This map contains for each rank the list of dofs the current rank must send * This map contains for each rank the list of dofs the current rank must send
* to exchange solution dofs at the interior boundaries. * to exchange solution dofs at the interior boundaries.
*/ */
std::map<int, std::vector<DegreeOfFreedom> > sendDofs; std::map<int, std::vector<const DegreeOfFreedom*> > sendDofs;
/** \brief /** \brief
* This map contains for each rank the list of dofs from which the current rank * This map contains for each rank the list of dofs from which the current rank
* must receive solution values of dofs at the interior boundaries. * must receive solution values of dofs at the interior boundaries.
*/ */
std::map<int, std::vector<DegreeOfFreedom> > recvDofs; std::map<int, std::vector<const DegreeOfFreedom*> > recvDofs;
/// Maps local to global dof indices. /// Maps local to global dof indices.
std::map<DegreeOfFreedom, DegreeOfFreedom> mapLocalGlobalDOFs; std::map<DegreeOfFreedom, DegreeOfFreedom> mapLocalGlobalDOFs;
......
...@@ -100,21 +100,14 @@ namespace AMDiS { ...@@ -100,21 +100,14 @@ namespace AMDiS {
{ {
coords_ = coords; coords_ = coords;
if (quad2) { if (quad2)
quad2->scaleSurfaceQuadrature(coords); quad2->scaleSurfaceQuadrature(coords);
} if (quad1GrdPsi)
if (quad1GrdPsi) {
quad1GrdPsi->scaleSurfaceQuadrature(coords); quad1GrdPsi->scaleSurfaceQuadrature(coords);
} if (quad1GrdPhi)
if (quad1GrdPhi) {
quad1GrdPhi->scaleSurfaceQuadrature(coords); quad1GrdPhi->scaleSurfaceQuadrature(coords);
} if (quad0)
if (quad0) {
quad0->scaleSurfaceQuadrature(coords); quad0->scaleSurfaceQuadrature(coords);
}
} }
/** \brief /** \brief
...@@ -126,16 +119,14 @@ namespace AMDiS { ...@@ -126,16 +119,14 @@ namespace AMDiS {
ElementMatrix& userMat, ElementMatrix& userMat,
double factor = 1.0) double factor = 1.0)
{ {
int i;
int dim = rowFESpace->getMesh()->getDim(); int dim = rowFESpace->getMesh()->getDim();
double origDet = elInfo->getDet(); double origDet = elInfo->getDet();
FixVec<WorldVector<double>, VERTEX> worldCoords(dim-1, NO_INIT); FixVec<WorldVector<double>, VERTEX> worldCoords(dim-1, NO_INIT);
// transform barycentric coords to world coords // transform barycentric coords to world coords
for(i = 0; i < dim; i++) { for (int i = 0; i < dim; i++)
elInfo->coordToWorld(coords_[i], worldCoords[i]); elInfo->coordToWorld(coords_[i], worldCoords[i]);
}
// set determinant for world coords of the side // set determinant for world coords of the side
const_cast<ElInfo*>(elInfo)->setDet(elInfo->calcDet(worldCoords)); const_cast<ElInfo*>(elInfo)->setDet(elInfo->calcDet(worldCoords));
...@@ -177,9 +168,7 @@ namespace AMDiS { ...@@ -177,9 +168,7 @@ namespace AMDiS {
protected: protected:
VectorOfFixVecs<DimVec<double> > coords_; VectorOfFixVecs<DimVec<double> > coords_;
/** \brief /// Surface quadratures
* Surface quadratures
*/
SurfaceQuadrature *quad2; SurfaceQuadrature *quad2;
SurfaceQuadrature *quad1GrdPsi; SurfaceQuadrature *quad1GrdPsi;
SurfaceQuadrature *quad1GrdPhi; SurfaceQuadrature *quad1GrdPhi;
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
namespace AMDiS { namespace AMDiS {
//std::list<SurfaceQuadrature*> SurfaceQuadrature::surfaceQuadratureList;
SurfaceQuadrature::SurfaceQuadrature(Quadrature *quad, SurfaceQuadrature::SurfaceQuadrature(Quadrature *quad,
VectorOfFixVecs<DimVec<double> > &coords) VectorOfFixVecs<DimVec<double> > &coords)
: Quadrature((quad->getName() + " surface").c_str(), : Quadrature((quad->getName() + " surface").c_str(),
...@@ -18,69 +16,39 @@ namespace AMDiS { ...@@ -18,69 +16,39 @@ namespace AMDiS {
quad_(quad), quad_(quad),
coords_(coords) coords_(coords)
{ {
int i, j, k;
// copy coords
// coords_ = new DimVec<double>[dim](dim, NO_INIT);
// for(i = 0; i < dim; i++) {
// coords_[i] = coords[i];
// }
lambda = new VectorOfFixVecs<DimVec<double> >(dim, n_points, NO_INIT); lambda = new VectorOfFixVecs<DimVec<double> >(dim, n_points, NO_INIT);
// for each integration point // for each integration point
for(i=0; i < n_points; i++) { for (int i = 0; i < n_points; i++) {
// get coords of quadrature point in dim-1 // get coords of quadrature point in dim-1
DimVec<double> origin = quad->getLambda(i); DimVec<double> origin = quad->getLambda(i);
for(j=0; j < dim+1; j++) for (int j = 0; j < dim + 1; j++)
(*lambda)[i][j] = 0.0; (*lambda)[i][j] = 0.0;
for(j = 0; j < dim; j++) { for (int j = 0; j < dim; j++)
for(k = 0; k < dim+1; k++) { for (int k = 0; k < dim + 1; k++)
(*lambda)[i][k] += origin[j] * coords_[j][k]; (*lambda)[i][k] += origin[j] * coords_[j][k];
}
}
// // create barycentric coords for dim
// if(dim > 1) {
// for (j = 0; j < side; j++)
// (*lambda)[i][j] = origin[j];
// (*lambda)[i][side] = 0.0;
// for (j = side+1; j <= dim; j++)
// (*lambda)[i][j] = origin[j-1];
// } else {
// (*lambda)[i][side] = 1.0;
// (*lambda)[i][1-side] = 0.0;
// }
} }
} }
void void SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
{ {
int i, j, k;
// copy coords // copy coords
for(i = 0; i < dim; i++) { for (int i = 0; i < dim; i++)
coords_[i] = coords[i]; coords_[i] = coords[i];
}
// for each integration point // for each integration point
for(i=0; i < n_points; i++) { for (int i = 0; i < n_points; i++) {
// get coords of quadrature point in dim-1 // get coords of quadrature point in dim-1
DimVec<double> origin = quad_->getLambda(i); DimVec<double> origin = quad_->getLambda(i);
for(j=0; j < dim+1; j++) for (int j = 0; j < dim + 1; j++)
(*lambda)[i][j] = 0.0; (*lambda)[i][j] = 0.0;
for(j = 0; j < dim; j++) { for (int j = 0; j < dim; j++)
for(k = 0; k < dim+1; k++) { for (int k = 0; k < dim+1; k++)
(*lambda)[i][k] += origin[j] * coords_[j][k]; (*lambda)[i][k] += origin[j] * coords_[j][k];
}
}
} }
} }
......
...@@ -39,36 +39,21 @@ namespace AMDiS { ...@@ -39,36 +39,21 @@ namespace AMDiS {
class SurfaceQuadrature : public Quadrature class SurfaceQuadrature : public Quadrature
{ {
public: public:
/** \brief /// Constructs a SurfaceQuadrature based on a standard Quadrature of dim-1.
* Constructs a SurfaceQuadrature based on a standard Quadrature of dim-1.
*/
SurfaceQuadrature(Quadrature *quad, VectorOfFixVecs<DimVec<double> >& coords); SurfaceQuadrature(Quadrature *quad, VectorOfFixVecs<DimVec<double> >& coords);
/** \brief /// Destructor.
* Destructor.
*/
~SurfaceQuadrature() ~SurfaceQuadrature()
{} {}
/** \brief /// Adapts SurfaceQuadrature to \ref coords.
* Adapts SurfaceQuadrature to \ref coords.
*/
void scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> > &coords); void scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> > &coords);
protected: protected:
/** \brief /// Pointer to the original quadrature
* Pointer to the original quadrature
*/
Quadrature *quad_; Quadrature *quad_;
VectorOfFixVecs<DimVec<double> > coords_; VectorOfFixVecs<DimVec<double> > coords_;
/** \brief
* List of all existing surface quadratures. Used by
* \ref provideSurfaceQuadrature(). If the needed quadrature is not in the
* list, a new list entry is created.
*/
//static std::list<SurfaceQuadrature*> surfaceQuadratureList;
}; };
} }
......
...@@ -31,7 +31,7 @@ namespace AMDiS { ...@@ -31,7 +31,7 @@ namespace AMDiS {
{ {
public: public:
inline bool isOfType(int typeID) const { inline bool isOfType(int typeID) const {
if(typeID == SURFACE_REGION) if (typeID == SURFACE_REGION)
return true; return true;
return false; return false;
} }
...@@ -39,7 +39,8 @@ namespace AMDiS { ...@@ -39,7 +39,8 @@ namespace AMDiS {
class Creator : public CreatorInterface<ElementData> class Creator : public CreatorInterface<ElementData>
{ {
public: public:
ElementData* create() { ElementData* create()
{
return new SurfaceRegion_ED; return new SurfaceRegion_ED;
} }
}; };
...@@ -61,7 +62,7 @@ namespace AMDiS { ...@@ -61,7 +62,7 @@ namespace AMDiS {
SurfaceRegion_ED *surfaceRegion; SurfaceRegion_ED *surfaceRegion;
sideOfChild = parent->getSideOfChild(0, side_, elType); sideOfChild = parent->getSideOfChild(0, side_, elType);
if(sideOfChild >= 0) { if (sideOfChild >= 0) {
surfaceRegion = new SurfaceRegion_ED(child1->getElementData()); surfaceRegion = new SurfaceRegion_ED(child1->getElementData());
surfaceRegion->setSide(sideOfChild); surfaceRegion->setSide(sideOfChild);
surfaceRegion->setRegion(region_); surfaceRegion->setRegion(region_);
...@@ -69,7 +70,7 @@ namespace AMDiS { ...@@ -69,7 +70,7 @@ namespace AMDiS {
} }
sideOfChild = parent->getSideOfChild(1, side_, elType); sideOfChild = parent->getSideOfChild(1, side_, elType);
if(sideOfChild >= 0) { if (sideOfChild >= 0) {
surfaceRegion = new SurfaceRegion_ED(child2->getElementData()); surfaceRegion = new SurfaceRegion_ED(child2->getElementData());
surfaceRegion->side_ = sideOfChild; surfaceRegion->side_ = sideOfChild;
surfaceRegion->region_ = region_; surfaceRegion->region_ = region_;
...@@ -77,41 +78,60 @@ namespace AMDiS { ...@@ -77,41 +78,60 @@ namespace AMDiS {
} }
return false; return false;
}; }
ElementData *clone() const { ElementData *clone() const
{
SurfaceRegion_ED *newObj = new SurfaceRegion_ED; SurfaceRegion_ED *newObj = new SurfaceRegion_ED;
newObj->side_ = side_; newObj->side_ = side_;
newObj->region_ = region_; newObj->region_ = region_;
newObj->decorated_ = ElementData::clone(); newObj->decorated_ = ElementData::clone();
return newObj; return newObj;
}; }
inline std::string getTypeName() const { return "SurfaceRegion_ED"; }; inline std::string getTypeName() const
{
return "SurfaceRegion_ED";
}
inline const int getTypeID() const { return SURFACE_REGION; }; inline const int getTypeID() const
{
return SURFACE_REGION;
}
void serialize(std::ostream& out) void serialize(std::ostream& out)
{ {
ElementData::serialize(out); ElementData::serialize(out);
out.write(reinterpret_cast<const char*>(&side_), sizeof(int)); out.write(reinterpret_cast<const char*>(&side_), sizeof(int));
out.write(reinterpret_cast<const char*>(&region_), sizeof(int)); out.write(reinterpret_cast<const char*>(&region_), sizeof(int));
}; }
void deserialize(std::istream& in) void deserialize(std::istream& in)
{ {
ElementData::deserialize(in); ElementData::deserialize(in);
in.read(reinterpret_cast<char*>(&side_), sizeof(int)); in.read(reinterpret_cast<char*>(&side_), sizeof(int));
in.read(reinterpret_cast<char*>(&region_), sizeof(int)); in.read(reinterpret_cast<char*>(&region_), sizeof(int));
}; }
inline void setSide(int side) { side_ = side; }; inline void setSide(int side)
{
side_ = side;
}
inline int getSide() const { return side_; }; inline int getSide() const
{
return side_;
}
inline void setRegion(int region) { region_ = region; }; inline void setRegion(int region)
{
region_ = region;
}
inline int getRegion() const { return region_; }; inline int getRegion() const
{
return region_;
}
protected: protected:
int side_; int side_;
......
...@@ -30,22 +30,15 @@ ...@@ -30,22 +30,15 @@
namespace AMDiS { namespace AMDiS {
/** \brief /// A system vector is a vector of dof vectors used for vector valued problems.
* A system vector is a vector of dof vectors used for vector valued