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 { ...@@ -40,7 +40,7 @@ namespace AMDiS {
// === read periodic data ================================= // === read periodic data =================================
if (periodicFile && (strcmp(periodicFile, "") != 0)) { 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"); FILE *file = fopen(periodicFile, "r");
TEST_EXIT(file)("can't open file %s\n", periodicFile); TEST_EXIT(file)("can't open file %s\n", periodicFile);
...@@ -54,13 +54,11 @@ namespace AMDiS { ...@@ -54,13 +54,11 @@ namespace AMDiS {
int mode = -1; // 0: drop dofs, 1: associate dofs int mode = -1; // 0: drop dofs, 1: associate dofs
int result; int result;
BoundaryType boundaryType; BoundaryType boundaryType;
PeriodicMap periodicMap;
fscanf(file, "%*s %d", &n); fscanf(file, "%*s %d", &n);
fscanf(file, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s"); fscanf(file, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s");
PeriodicMap periodicMap;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
std::map<int, int> vertexMapEl1; std::map<int, int> vertexMapEl1;
std::map<int, int> vertexMapEl2; std::map<int, int> vertexMapEl2;
...@@ -119,6 +117,7 @@ namespace AMDiS { ...@@ -119,6 +117,7 @@ namespace AMDiS {
for (int j = 0; j < dim; j++) { for (int j = 0; j < dim; j++) {
periodicCoordsEl1[element1->getPositionOfVertex(sideEl1, verticesEl1[j])] = periodicCoordsEl1[element1->getPositionOfVertex(sideEl1, verticesEl1[j])] =
coords[melVertex[el2][vertexMapEl1[verticesEl1[j]]]]; coords[melVertex[el2][vertexMapEl1[verticesEl1[j]]]];
periodicCoordsEl2[element2->getPositionOfVertex(sideEl2, verticesEl2[j])] = periodicCoordsEl2[element2->getPositionOfVertex(sideEl2, verticesEl2[j])] =
coords[melVertex[el1][vertexMapEl2[verticesEl2[j]]]]; coords[melVertex[el1][vertexMapEl2[verticesEl2[j]]]];
} }
...@@ -848,11 +847,8 @@ namespace AMDiS { ...@@ -848,11 +847,8 @@ namespace AMDiS {
void MacroInfo::fillBoundaryInfo(Mesh *mesh) void MacroInfo::fillBoundaryInfo(Mesh *mesh)
{ {
int i, j, k, nv = mesh->getNumberOfVertices(); int i, j, k, nv = mesh->getNumberOfVertices();
std::deque<MacroElement*>::iterator melIt; std::deque<MacroElement*>::iterator melIt;
BoundaryType *bound = new BoundaryType[nv]; BoundaryType *bound = new BoundaryType[nv];
int dim = mesh->getDim(); int dim = mesh->getDim();
switch(dim) { switch(dim) {
......
...@@ -126,6 +126,7 @@ namespace AMDiS { ...@@ -126,6 +126,7 @@ namespace AMDiS {
FUNCNAME("Triangle::getSideOfChild()"); FUNCNAME("Triangle::getSideOfChild()");
TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n"); 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"); TEST_EXIT_DBG(side >= 0 && side <= 2)("side must be between 0 and 2\n");
return sideOfChild[child][side]; return sideOfChild[child][side];
} }
...@@ -135,19 +136,26 @@ namespace AMDiS { ...@@ -135,19 +136,26 @@ namespace AMDiS {
FUNCNAME("Triangle::getVertexOfParent()"); FUNCNAME("Triangle::getVertexOfParent()");
TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n"); 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"); TEST_EXIT_DBG(side >= 0 && side <= 2)("side must be between 0 and 2\n");
return vertexOfParent[child][side]; return vertexOfParent[child][side];
} }
virtual int getPositionOfVertex(int side, int vertex) const 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}}; static int positionOfVertex[3][3] = {{-1, 0, 1}, {1, -1, 0}, {0, 1, -1}};
return positionOfVertex[side][vertex]; return positionOfVertex[side][vertex];
} }
inline int getEdgeOfFace(int face, int edge) const 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(face == 0)("face must be zero at triangle\n");
TEST_EXIT_DBG(edge >= 0 && edge < 3)("invalid edge\n"); TEST_EXIT_DBG(edge >= 0 && edge < 3)("invalid edge\n");
return edge; 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