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"
# ### BEGIN LIBTOOL CONFIG
# Libtool was configured on host p1d062:
# Libtool was configured on host p2q004:
# Shell to use when invoking shell scripts.
SHELL="/bin/sh"
......@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
# End:
# ### 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="/bin/sh"
......@@ -7065,7 +7065,7 @@ include_expsyms=""
# ### 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="/bin/sh"
......
......@@ -84,7 +84,6 @@
#include "SystemVector.h"
#include "TecPlotWriter.h"
#include "Tetrahedron.h"
#include "TimedObject.h"
#include "Traverse.h"
#include "Triangle.h"
#include "ValueWriter.h"
......
......@@ -213,7 +213,7 @@ namespace AMDiS {
/// Sets \ref firstHole
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;
}
......
......@@ -216,7 +216,8 @@ namespace AMDiS {
applyDBCs.insert(static_cast<int>(row));
#endif
}
} else
} else {
for (int j = 0; j < nCol; j++) { // for all columns
DegreeOfFreedom col = colIndices[j];
double entry = elMat[i][j];
......@@ -228,6 +229,7 @@ namespace AMDiS {
}
}
}
}
double DOFMatrix::logAcc(DegreeOfFreedom a, DegreeOfFreedom b) const
{
......@@ -250,18 +252,6 @@ namespace AMDiS {
(*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0);
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,
......
This diff is collapsed.
......@@ -130,6 +130,18 @@ namespace AMDiS {
/// Removes all macro elements from the mesh that are not part of ranks partition.
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,
std::map<const DegreeOfFreedom*, int>& boundaryDOFs,
int& nRankDOFs,
......@@ -138,8 +150,7 @@ namespace AMDiS {
void updateLocalGlobalNumbering(int& nRankDOFs, int& nOverallDOFs);
void addAllDOFs(Element *el, int ithEdge,
std::vector<const DegreeOfFreedom*>& dofs,
bool addVertices = true);
std::vector<const DegreeOfFreedom*>& dofs);
/** \brief
* This function traverses the whole mesh, i.e. before it is really partitioned,
......@@ -220,6 +231,12 @@ namespace AMDiS {
/// Number of DOFs in the rank mesh.
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
* 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.,
......@@ -240,13 +257,13 @@ namespace AMDiS {
* This map contains for each rank the list of dofs the current rank must send
* to exchange solution dofs at the interior boundaries.
*/
std::map<int, std::vector<DegreeOfFreedom> > sendDofs;
std::map<int, std::vector<const DegreeOfFreedom*> > sendDofs;
/** \brief
* 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.
*/
std::map<int, std::vector<DegreeOfFreedom> > recvDofs;
std::map<int, std::vector<const DegreeOfFreedom*> > recvDofs;
/// Maps local to global dof indices.
std::map<DegreeOfFreedom, DegreeOfFreedom> mapLocalGlobalDOFs;
......
......@@ -100,22 +100,15 @@ namespace AMDiS {
{
coords_ = coords;
if (quad2) {
if (quad2)
quad2->scaleSurfaceQuadrature(coords);
}
if (quad1GrdPsi) {
if (quad1GrdPsi)
quad1GrdPsi->scaleSurfaceQuadrature(coords);
}
if (quad1GrdPhi) {
if (quad1GrdPhi)
quad1GrdPhi->scaleSurfaceQuadrature(coords);
}
if (quad0) {
if (quad0)
quad0->scaleSurfaceQuadrature(coords);
}
}
/** \brief
* Implementation of \ref Operator::getElementMatrix(). Repalces the
......@@ -126,16 +119,14 @@ namespace AMDiS {
ElementMatrix& userMat,
double factor = 1.0)
{
int i;
int dim = rowFESpace->getMesh()->getDim();
double origDet = elInfo->getDet();
FixVec<WorldVector<double>, VERTEX> worldCoords(dim-1, NO_INIT);
// 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]);
}
// set determinant for world coords of the side
const_cast<ElInfo*>(elInfo)->setDet(elInfo->calcDet(worldCoords));
......@@ -177,9 +168,7 @@ namespace AMDiS {
protected:
VectorOfFixVecs<DimVec<double> > coords_;
/** \brief
* Surface quadratures
*/
/// Surface quadratures
SurfaceQuadrature *quad2;
SurfaceQuadrature *quad1GrdPsi;
SurfaceQuadrature *quad1GrdPhi;
......
......@@ -5,8 +5,6 @@
namespace AMDiS {
//std::list<SurfaceQuadrature*> SurfaceQuadrature::surfaceQuadratureList;
SurfaceQuadrature::SurfaceQuadrature(Quadrature *quad,
VectorOfFixVecs<DimVec<double> > &coords)
: Quadrature((quad->getName() + " surface").c_str(),
......@@ -18,70 +16,40 @@ namespace AMDiS {
quad_(quad),
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);
// 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
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;
for(j = 0; j < dim; j++) {
for(k = 0; k < dim+1; k++) {
for (int j = 0; j < dim; j++)
for (int k = 0; k < dim + 1; 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
SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
void SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
{
int i, j, k;
// copy coords
for(i = 0; i < dim; i++) {
for (int i = 0; i < dim; i++)
coords_[i] = coords[i];
}
// 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
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;
for(j = 0; j < dim; j++) {
for(k = 0; k < dim+1; k++) {
for (int j = 0; j < dim; j++)
for (int k = 0; k < dim+1; k++)
(*lambda)[i][k] += origin[j] * coords_[j][k];
}
}
}
}
}
......@@ -39,36 +39,21 @@ namespace AMDiS {
class SurfaceQuadrature : public Quadrature
{
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);
/** \brief
* Destructor.
*/
/// Destructor.
~SurfaceQuadrature()
{}
/** \brief
* Adapts SurfaceQuadrature to \ref coords.
*/
/// Adapts SurfaceQuadrature to \ref coords.
void scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> > &coords);
protected:
/** \brief
* Pointer to the original quadrature
*/
/// Pointer to the original quadrature
Quadrature *quad_;
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 {
{
public:
inline bool isOfType(int typeID) const {
if(typeID == SURFACE_REGION)
if (typeID == SURFACE_REGION)
return true;
return false;
}
......@@ -39,7 +39,8 @@ namespace AMDiS {
class Creator : public CreatorInterface<ElementData>
{
public:
ElementData* create() {
ElementData* create()
{
return new SurfaceRegion_ED;
}
};
......@@ -61,7 +62,7 @@ namespace AMDiS {
SurfaceRegion_ED *surfaceRegion;
sideOfChild = parent->getSideOfChild(0, side_, elType);
if(sideOfChild >= 0) {
if (sideOfChild >= 0) {
surfaceRegion = new SurfaceRegion_ED(child1->getElementData());
surfaceRegion->setSide(sideOfChild);
surfaceRegion->setRegion(region_);
......@@ -69,7 +70,7 @@ namespace AMDiS {
}
sideOfChild = parent->getSideOfChild(1, side_, elType);
if(sideOfChild >= 0) {
if (sideOfChild >= 0) {
surfaceRegion = new SurfaceRegion_ED(child2->getElementData());
surfaceRegion->side_ = sideOfChild;
surfaceRegion->region_ = region_;
......@@ -77,41 +78,60 @@ namespace AMDiS {
}
return false;
};
}
ElementData *clone() const {
ElementData *clone() const
{
SurfaceRegion_ED *newObj = new SurfaceRegion_ED;
newObj->side_ = side_;
newObj->region_ = region_;
newObj->decorated_ = ElementData::clone();
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)
{
ElementData::serialize(out);
out.write(reinterpret_cast<const char*>(&side_), sizeof(int));
out.write(reinterpret_cast<const char*>(&region_), sizeof(int));
};
}
void deserialize(std::istream& in)
{
ElementData::deserialize(in);
in.read(reinterpret_cast<char*>(&side_), 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:
int side_;
......
......@@ -30,22 +30,15 @@
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 problems.
class SystemVector : public Serializable
{
public:
/** \brief
* Creator.
*/
/// Creator.
class Creator
: public CreatorInterface<SystemVector> {
public:
/** \brief
* Creators constructor.
*/
/// Creators constructor.
Creator(const std::string &name_,
std::vector<FiniteElemSpace*> feSpace_,
int size_)
......@@ -54,15 +47,12 @@ namespace AMDiS {
size(size_)
{}
/** \brief
* Destructor
*/
/// Destructor
virtual ~Creator() {}
/** \brief
* Implementation of CreatorInterface::create().
*/
SystemVector *create() {
/// Implementation of CreatorInterface::create().
SystemVector *create()
{
char number[10];
std::string numberedName;
SystemVector *result = new SystemVector(name, feSpace, size);
......@@ -74,10 +64,9 @@ namespace AMDiS {
return result;
}
/** \brief
* Implementation of CreatorInterface::free().
*/
void free(SystemVector *vec) {
/// Implementation of CreatorInterface::free().
void free(SystemVector *vec)
{
for (int i = 0; i < size; i++) {
delete vec->getDOFVector(i);
vec->setDOFVector(i, NULL);
......@@ -86,26 +75,18 @@ namespace AMDiS {
}
private:
/** \brief
* Name of the system vector
*/
/// Name of the system vector
std::string name;
/** \brief
* Finite element space used for creation.
*/
/// Finite element space used for creation.
std::vector<FiniteElemSpace*> feSpace;
/** \brief
* Number of component vectors to be created
*/
/// Number of component vectors to be created
int size;
};
public:
/** \brief
* Constructor.
*/
/// Constructor.
SystemVector(const std::string& name_,
std::vector<FiniteElemSpace*> feSpace_,
int size)
......@@ -117,92 +98,80 @@ namespace AMDiS {
vectors.set(NULL);
}
/** \brief
* Copy Constructor.
*/
/// Copy Constructor.
SystemVector(const SystemVector& rhs)
: name(rhs.name),
feSpace(rhs.feSpace),
vectors(rhs.vectors.getSize())
{
for (int i = 0; i < vectors.getSize(); i++) {
for (int i = 0; i < vectors.getSize(); i++)
vectors[i] = new DOFVector<double>(*rhs.vectors[i]);
}
}
~SystemVector()
{
for (int i = 0; i < vectors.getSize(); i++) {
for (int i = 0; i < vectors.getSize(); i++)
delete vectors[i];
}
}
void createNewDOFVectors(std::string name)
{
for (int i = 0; i < vectors.getSize(); i++) {
for (int i = 0; i < vectors.getSize(); i++)
vectors[i] = new DOFVector<double>(feSpace[i], "tmp");
}
}
/** \brief
* Sets \ref vectors[index] = vec.
*/
inline void setDOFVector(int index, DOFVector<double> *vec) {
/// Sets \ref vectors[index] = vec.
inline void setDOFVector(int index, DOFVector<double> *vec)
{
TEST_EXIT_DBG(index < vectors.getSize())("invalid index\n");
vectors[index] = vec;
}
/** \brief
* Returns \ref vectors[index].
*/
inline DOFVector<double> *getDOFVector(int index) {
/// Returns \ref vectors[index].
inline DOFVector<double> *getDOFVector(int index)
{
TEST_EXIT_DBG(index < vectors.getSize())("invalid index\n");
return vectors[index];
}
/** \brief
* Returns \ref vectors[index].
*/
inline const DOFVector<double> *getDOFVector(int index) const {
/// Returns \ref vectors[index].
inline const DOFVector<double> *getDOFVector(int index) const
{
TEST_EXIT_DBG(index < vectors.getSize())("invalid index\n");
return vectors[index];
}
/** \brief
* Returns sum of used vector sizes.
*/
inline int getUsedSize() const {
/// Returns sum of used vector sizes.
inline int getUsedSize() const
{
int totalSize = 0;
int size = vectors.getSize();
for (int i = 0; i < size; i++) {
for (int i = 0; i < size; i++)
totalSize += vectors[i]->getUsedSize();
}
return totalSize;
}
/** \brief
* Returns number of contained vectors.
*/
inline int getNumVectors() const {
/// Returns number of contained vectors.
inline int getNumVectors() const
{
return vectors.getSize();