Commit dfe3c85e authored by Thomas Witkowski's avatar Thomas Witkowski

Added more tests (in debug mode) for reading macros.

parent f13f7769
......@@ -40,7 +40,7 @@ namespace AMDiS {
// === read periodic data =================================
if (periodicFile && (strcmp(periodicFile, "") != 0)) {
WARNING("periodic boundaries may lead to errors in small meshes if element neighbours not set\n");
WARNING("Periodic boundaries may lead to errors in small meshes if element neighbours are not set!\n");
FILE *file = fopen(periodicFile, "r");
TEST_EXIT(file)("can't open file %s\n", periodicFile);
......@@ -54,13 +54,11 @@ namespace AMDiS {
int mode = -1; // 0: drop dofs, 1: associate dofs
int result;
BoundaryType boundaryType;
PeriodicMap periodicMap;
fscanf(file, "%*s %d", &n);
fscanf(file, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s");
PeriodicMap periodicMap;
for (int i = 0; i < n; i++) {
std::map<int, int> vertexMapEl1;
std::map<int, int> vertexMapEl2;
......@@ -107,22 +105,23 @@ namespace AMDiS {
sideEl2 -= verticesEl2[j];
}
}
// create periodic info
DimVec<WorldVector<double> > periodicCoordsEl1(dim - 1, NO_INIT);
DimVec<WorldVector<double> > periodicCoordsEl2(dim - 1, NO_INIT);
Element *element1 = const_cast<Element*>((*(mel + el1))->getElement());
Element *element2 = const_cast<Element*>((*(mel + el2))->getElement());
// for all vertices of this side
for (int j = 0; j < dim; j++) {
periodicCoordsEl1[element1->getPositionOfVertex(sideEl1, verticesEl1[j])] =
coords[melVertex[el2][vertexMapEl1[verticesEl1[j]]]];
periodicCoordsEl2[element2->getPositionOfVertex(sideEl2, verticesEl2[j])] =
coords[melVertex[el1][vertexMapEl2[verticesEl2[j]]]];
}
// decorate leaf data
ElementData *ld1 = element1->getElementData();
ElementData *ld2 = element2->getElementData();
......@@ -848,11 +847,8 @@ namespace AMDiS {
void MacroInfo::fillBoundaryInfo(Mesh *mesh)
{
int i, j, k, nv = mesh->getNumberOfVertices();
std::deque<MacroElement*>::iterator melIt;
BoundaryType *bound = new BoundaryType[nv];
int dim = mesh->getDim();
switch(dim) {
......
......@@ -126,6 +126,7 @@ namespace AMDiS {
FUNCNAME("Triangle::getSideOfChild()");
TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n");
TEST_EXIT_DBG(side >= 0 && side <= 2)("side must be between 0 and 2\n");
return sideOfChild[child][side];
}
......@@ -135,19 +136,26 @@ namespace AMDiS {
FUNCNAME("Triangle::getVertexOfParent()");
TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n");
TEST_EXIT_DBG(side >= 0 && side <= 2)("side must be between 0 and 2\n");
return vertexOfParent[child][side];
}
virtual int getPositionOfVertex(int side, int vertex) const
{
FUNCNAME("Triangle::getPositionOfVertex()");
TEST_EXIT_DBG(side >= 0 && side <= 2)("Wrong side number %d!\n", side);
TEST_EXIT_DBG(vertex >= 0 && vertex <= 2)("Wrong vertex number %d!\n", vertex);
static int positionOfVertex[3][3] = {{-1, 0, 1}, {1, -1, 0}, {0, 1, -1}};
return positionOfVertex[side][vertex];
}
inline int getEdgeOfFace(int face, int edge) const
{
FUNCNAME("Triangle::getEdgeOfFace()");
TEST_EXIT_DBG(face == 0)("face must be zero at triangle\n");
TEST_EXIT_DBG(edge >= 0 && edge < 3)("invalid edge\n");
return edge;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment