Commit 42521b59 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Introduction of TEST_EXIT_DBG

parent e6a9f68e
......@@ -38,7 +38,7 @@ INCLUDES = $(AMDIS_INCLUDES) $(PARALLEL_INCLUDES)
if AMDIS_DEBUG
libamdis_la_CXXFLAGS += -g -O0 -Wall -DDEBUG=1 $(OPENMP_FLAG) -ftemplate-depth-30 $(INCLUDES) #-pedantic
else
libamdis_la_CXXFLAGS += -O3 -Wall -DDEBUG=0 $(OPENMP_FLAG) -ftemplate-depth-30 $(INCLUDES) #-pedantic
libamdis_la_CXXFLAGS += -O2 -Wall -DDEBUG=0 $(OPENMP_FLAG) -ftemplate-depth-30 $(INCLUDES) #-pedantic
endif
......
......@@ -42,7 +42,7 @@ host_triplet = @host@
@ENABLE_UMFPACK_TRUE@ -I$(LIB_DIR)/UMFPACK/Include
@AMDIS_DEBUG_TRUE@am__append_3 = -g -O0 -Wall -DDEBUG=1 $(OPENMP_FLAG) -ftemplate-depth-30 $(INCLUDES) #-pedantic
@AMDIS_DEBUG_FALSE@am__append_4 = -O3 -Wall -DDEBUG=0 $(OPENMP_FLAG) -ftemplate-depth-30 $(INCLUDES) #-pedantic
@AMDIS_DEBUG_FALSE@am__append_4 = -O2 -Wall -DDEBUG=0 $(OPENMP_FLAG) -ftemplate-depth-30 $(INCLUDES) #-pedantic
subdir = bin
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
......
......@@ -150,7 +150,7 @@ namespace AMDiS {
const DOFVectorBase<double>* vec = dv ? dv : owner->operat->getUhOld();
TEST_EXIT(vec)("no dof vector!\n");
TEST_EXIT_DBG(vec)("no dof vector!\n");
if (valuesAtQPs[vec] && valuesAtQPs[vec]->valid)
return valuesAtQPs[vec]->values.getValArray();
......@@ -206,7 +206,7 @@ namespace AMDiS {
const DOFVectorBase<double>* vec = dv ? dv : owner->operat->getUhOld();
TEST_EXIT(vec)("no dof vector!\n");
TEST_EXIT_DBG(vec)("no dof vector!\n");
if (gradientsAtQPs[vec] && gradientsAtQPs[vec]->valid)
return gradientsAtQPs[vec]->values.getValArray();
......
......@@ -132,7 +132,6 @@ namespace AMDiS {
* Sets \ref quadrature to q.
*/
inline void setQuadrature(Quadrature* q) {
/* TEST_EXIT(!quadrature)("quadrature already set\n"); */
quadrature = q;
};
......@@ -1015,22 +1014,22 @@ namespace AMDiS {
Quadrature *quad1GrdPhi,
Quadrature *quad0)
{
if(secondOrderAssembler) {
if (secondOrderAssembler) {
TEST_EXIT(!secondOrderAssembler->getQuadrature())
("quadrature already existing\n");
secondOrderAssembler->setQuadrature(quad2);
}
if(firstOrderAssemblerGrdPsi) {
if (firstOrderAssemblerGrdPsi) {
TEST_EXIT(!firstOrderAssemblerGrdPsi->getQuadrature())
("quadrature already existing\n");
firstOrderAssemblerGrdPsi->setQuadrature(quad1GrdPsi);
}
if(firstOrderAssemblerGrdPhi) {
if (firstOrderAssemblerGrdPhi) {
TEST_EXIT(!firstOrderAssemblerGrdPhi->getQuadrature())
("quadrature already existing\n");
firstOrderAssemblerGrdPhi->setQuadrature(quad1GrdPhi);
}
if(zeroOrderAssembler) {
if (zeroOrderAssembler) {
TEST_EXIT(!zeroOrderAssembler->getQuadrature())
("quadrature already existing\n");
zeroOrderAssembler->setQuadrature(quad0);
......
......@@ -43,10 +43,7 @@ namespace AMDiS {
/** \brief
* Calls base class constructor and checks dimension of mesh.
*/
CoarseningManager1d() : CoarseningManager() {
// FUNCNAME("CoarseningManager1d::CoarseningManager1d");
// TEST_EXIT(mesh->getDim()==1)("mesh->dim != 1\n");
};
CoarseningManager1d() : CoarseningManager() {};
/** \brief
* destructor
......
......@@ -25,7 +25,7 @@ namespace AMDiS {
child[0] = dynamic_cast<Triangle*>(const_cast<Element*>( el->getChild(0)));
child[1] = dynamic_cast<Triangle*>(const_cast<Element*>( el->getChild(1)));
TEST_EXIT(child[0]->getMark() < 0 && child[1]->getMark() < 0)
TEST_EXIT_DBG(child[0]->getMark() < 0 && child[1]->getMark() < 0)
("element %d with children[%d,%d] must not be coarsend!\n",
el->getIndex(), child[0]->getIndex(), child[1]->getIndex());
......@@ -202,57 +202,53 @@ namespace AMDiS {
int CoarseningManager2d::coarsenFunction(ElInfo *el_info)
{
Triangle *el = dynamic_cast<Triangle*>(const_cast<Element*>( el_info->getElement()));
Triangle *el = dynamic_cast<Triangle*>(const_cast<Element*>( el_info->getElement()));
DegreeOfFreedom *edge[2];
int n_neigh, bound = 0;
int n_neigh, bound = 0;
RCNeighbourList coarse_list(2);
coarse_list.setCoarseningManager(this);
if (el->getMark() >= 0) return 0; // el must not be coarsend, return
if (!(el->getChild(0))) return 0; // single leaves don't get coarsened
if (el->getChild(0)->getMark() >= 0 || el->getChild(1)->getMark() >= 0)
{
/****************************************************************************/
/* one of the children must not be coarsend; return :-( */
/****************************************************************************/
el->setMark(0);
return 0;
}
if (el->getMark() >= 0)
return 0; // el must not be coarsend, return
if (!(el->getChild(0)))
return 0; // single leaves don't get coarsened
if (el->getChild(0)->getMark() >= 0 || el->getChild(1)->getMark() >= 0) {
/****************************************************************************/
/* one of the children must not be coarsend; return :-( */
/****************************************************************************/
el->setMark(0);
return 0;
}
if (!el->getChild(0)->isLeaf() || !el->getChild(1)->isLeaf())
{
/****************************************************************************/
/* one of the children is not a leaf element; try again later on */
/****************************************************************************/
doMore = true;
return 0;
}
if (!el->getChild(0)->isLeaf() || !el->getChild(1)->isLeaf()) {
/****************************************************************************/
/* one of the children is not a leaf element; try again later on */
/****************************************************************************/
doMore = true;
return 0;
}
/****************************************************************************/
/* give the refinement edge the right orientation */
/****************************************************************************/
if (el->getDOF(0,0) < el->getDOF(1,0))
{
edge[0] = const_cast<int*>( el->getDOF(0));
edge[1] = const_cast<int*>( el->getDOF(1));
}
else
{
edge[1] = const_cast<int*>( el->getDOF(0));
edge[0] = const_cast<int*>( el->getDOF(1));
}
if (el->getDOF(0,0) < el->getDOF(1,0)) {
edge[0] = const_cast<int*>( el->getDOF(0));
edge[1] = const_cast<int*>( el->getDOF(1));
} else {
edge[1] = const_cast<int*>( el->getDOF(0));
edge[0] = const_cast<int*>( el->getDOF(1));
}
coarse_list.setElement(0, el, true);
n_neigh = 1;
if (coarse_list.setElement(1, el_info->getNeighbour(2)))
{
n_neigh = 2;
coarse_list.setCoarsePatch(1, el_info->getOppVertex(2) == 2);
}
if (coarse_list.setElement(1, el_info->getNeighbour(2))) {
n_neigh = 2;
coarse_list.setCoarsePatch(1, el_info->getOppVertex(2) == 2);
}
/****************************************************************************/
/* check wether we can coarsen the patch or not */
......@@ -262,20 +258,20 @@ namespace AMDiS {
// === check for periodic boundary ==========================================
// ==========================================================================
if(coarse_list.doCoarsePatch(n_neigh)) {
if (coarse_list.doCoarsePatch(n_neigh)) {
int n_neigh_periodic;
DegreeOfFreedom *next_edge[2];
RCNeighbourList *periodicList;
while(edge[0] != NULL) {
while (edge[0] != NULL) {
periodicList = coarse_list.periodicSplit(edge,
next_edge,
&n_neigh,
&n_neigh_periodic);
TEST_EXIT(periodicList)("periodicList = NULL\n");
TEST_EXIT_DBG(periodicList)("periodicList = NULL\n");
coarsenPatch(periodicList, n_neigh_periodic, bound);
......
......@@ -49,11 +49,11 @@ namespace AMDiS {
/****************************************************************************/
if (el->getDOF(0,0) < el->getDOF(1,0)) {
edge[0] = const_cast<int*>( el->getDOF(0));
edge[1] = const_cast<int*>( el->getDOF(1));
edge[0] = const_cast<int*>(el->getDOF(0));
edge[1] = const_cast<int*>(el->getDOF(1));
} else {
edge[1] = const_cast<int*>( el->getDOF(0));
edge[0] = const_cast<int*>( el->getDOF(1));
edge[1] = const_cast<int*>(el->getDOF(0));
edge[0] = const_cast<int*>(el->getDOF(1));
}
coarsenList->setElement(0, el, true);
......@@ -72,51 +72,24 @@ namespace AMDiS {
/* check wether we can coarsen the patch or not */
/****************************************************************************/
// // ==========================================================================
// // === check for periodic boundary ==========================================
// // ==========================================================================
// DegreeOfFreedom *periodic_edge[2];
// int n_neigh_periodic;
// RCNeighbourList *periodicList = coarsenList->periodicSplit(edge,
// &n_neigh,
// periodic_edge,
// &n_neigh_periodic);
// bool doCoarsening = coarsenList->doCoarsePatch(n_neigh);
// if(periodicList && doCoarsening) {
// if (periodicList->doCoarsePatch(n_neigh_periodic)) {
// coarsenPatch(periodicList, n_neigh_periodic, bound);
// } else {
// doCoarsening = false;
// }
// DELETE periodicList;
// }
// if (coarsenList->doCoarsePatch(n_neigh)/*doCoarsening*/) {
// coarsenPatch(coarsenList, n_neigh, bound);
// }
// ==========================================================================
// === check for periodic boundary ==========================================
// ==========================================================================
if(coarsenList->doCoarsePatch(n_neigh)) {
if (coarsenList->doCoarsePatch(n_neigh)) {
int n_neigh_periodic;
DegreeOfFreedom *next_edge[2];
RCNeighbourList *periodicList;
while(edge[0] != NULL) {
while (edge[0] != NULL) {
periodicList = coarsenList->periodicSplit(edge,
next_edge,
&n_neigh,
&n_neigh_periodic);
TEST_EXIT(periodicList)("periodicList = NULL\n");
TEST_EXIT_DBG(periodicList)("periodicList = NULL\n");
coarsenPatch(periodicList, n_neigh_periodic, bound);
......@@ -255,7 +228,7 @@ namespace AMDiS {
opp_v = el_info->getOppVertex(3-dir);
neigh_info = stack->traverseNeighbour3d(el_info, 3-dir);
TEST_EXIT(neigh == neigh_info->getElement())
TEST_EXIT_DBG(neigh == neigh_info->getElement())
("neigh %d and neigh_info->el %d are not identical\n",
neigh->getIndex(), neigh_info->getElement()->getIndex());
/****************************************************************************/
......@@ -280,7 +253,7 @@ namespace AMDiS {
for (k = 0; k < n_vertices; k++)
if (mesh->associated(neigh->getDOF(k, 0), edge[1][0])) break;
TEST_EXIT(j < n_vertices && k < n_vertices)
TEST_EXIT_DBG(j < n_vertices && k < n_vertices)
("dof %d or dof %d not found on element %d with nodes (%d %d %d %d)\n",
edge[0][0], edge[1][0], neigh->getIndex(), neigh->getDOF(0,0),
neigh->getDOF(1,0), neigh->getDOF(2,0), neigh->getDOF(3,0));
......@@ -302,7 +275,7 @@ namespace AMDiS {
opp_v = neigh_info->getOppVertex(i);
if ((neigh = dynamic_cast<Tetrahedron*>(const_cast<Element*>( neigh_info->getNeighbour(i))))) {
neigh_info = stack->traverseNeighbour3d(neigh_info, i);
TEST_EXIT(neigh == neigh_info->getElement())
TEST_EXIT_DBG(neigh == neigh_info->getElement())
("neigh %d and neigh_info->el %d are not identical\n",
neigh->getIndex(), neigh_info->getElement()->getIndex());
/****************************************************************************/
......@@ -326,7 +299,7 @@ namespace AMDiS {
i = *n_neigh-1;
opp_v = coarsenList->getOppVertex(i, 0);
do {
TEST_EXIT(neigh_info->getNeighbour(opp_v) && i > 0)
TEST_EXIT_DBG(neigh_info->getNeighbour(opp_v) && i > 0)
("while looping back domains boundary was reached or i == 0\n");
opp_v = coarsenList->getOppVertex(i--, 0);
neigh_info = stack->traverseNeighbour3d(neigh_info, opp_v);
......
......@@ -43,10 +43,7 @@ namespace AMDiS {
/** \brief
* Calls base class constructor and checks dimension of mesh.
*/
CoarseningManager3d() : CoarseningManager() {
// FUNCNAME("CoarseningManager3d::CoarseningManager3d");
// TEST_EXIT(mesh->getDim()==3)("mesh->dim != 3\n");
};
CoarseningManager3d() : CoarseningManager() {};
/** \brief
* destructor
......
......@@ -26,10 +26,10 @@ namespace AMDiS {
PartitionElementData *elData = dynamic_cast<PartitionElementData*>
(elInfo->getElement()->getElementData(PARTITION_ED));
TEST_EXIT(elInfo->getElement()->isLeaf())("element not leaf\n");
TEST_EXIT(elData)("no partitoin data on leaf element %d (rank %d)\n",
elInfo->getElement()->getIndex(),
MPI::COMM_WORLD.Get_rank());
TEST_EXIT_DBG(elInfo->getElement()->isLeaf())("element not leaf\n");
TEST_EXIT_DBG(elData)("no partitoin data on leaf element %d (rank %d)\n",
elInfo->getElement()->getIndex(),
MPI::COMM_WORLD.Get_rank());
PartitionStatus status = elData->getPartitionStatus();
......
......@@ -89,30 +89,22 @@ namespace AMDiS {
void markElement(AdaptInfo *adaptInfo, ElInfo *elInfo) {
FUNCNAME("ConditionalMarker::markElement()");
if(decoratedMarker_) {
if (decoratedMarker_) {
PartitionElementData *elData =
dynamic_cast<PartitionElementData*>(elInfo->getElement()->
getElementData(PARTITION_ED));
TEST_EXIT(elData)("no partition data\n");
TEST_EXIT_DBG(elData)("no partition data\n");
decoratedMarker_->markElement(adaptInfo, elInfo);
if(elData->getPartitionStatus() == OUT) {
//if(elData->getPartitionStatus() != IN) {
// allow coarsening, forbid refinement
if (elData->getPartitionStatus() == OUT) {
Element *element = elInfo->getElement();
if(element->getMark() > 0) {
if (element->getMark() > 0) {
element->setMark(0);
}
}
// if(elInfo->getElement()->getMark() != 0) {
// MSG("rank %d , index %d, mark %d\n",
// MPI::COMM_WORLD.Get_rank(), elInfo->getElement()->getIndex(),
// elInfo->getElement()->getMark());
// }
int minLevel =
elData->getPartitionStatus() != OUT ?
localCoarseGridLevel_ :
......
......@@ -39,22 +39,20 @@ namespace AMDiS {
DOFAdmin& DOFAdmin::operator=(const DOFAdmin& src)
{
int i;
if (this!=&src) {
mesh=src.mesh;
name=src.name;
dofFree=src.dofFree;
firstHole=src.firstHole;
size=src.size;
usedCount=src.usedCount;
holeCount=src.holeCount;
sizeUsed=src.sizeUsed;
for(i=0;i<4;nrDOF[i]=src.nrDOF[i++]) {
nr0DOF[i]=src.nr0DOF[i];
if (this != &src) {
mesh = src.mesh;
name = src.name;
dofFree = src.dofFree;
firstHole = src.firstHole;
size = src.size;
usedCount = src.usedCount;
holeCount = src.holeCount;
sizeUsed = src.sizeUsed;
for (int i = 0; i < 4; nrDOF[i] = src.nrDOF[i++]) {
nr0DOF[i] = src.nr0DOF[i];
};
dofIndexedList=src.dofIndexedList;
dofContainerList=src.dofContainerList;
dofIndexedList = src.dofIndexedList;
dofContainerList = src.dofContainerList;
}
return *this;
}
......@@ -65,8 +63,11 @@ namespace AMDiS {
bool DOFAdmin::operator==(const DOFAdmin& ad) const
{
if (name!=ad.name) return false;
if (mesh!=ad.mesh) return false;
if (name != ad.name)
return false;
if (mesh != ad.mesh)
return false;
return true;
}
......@@ -75,10 +76,10 @@ namespace AMDiS {
{}
void DOFAdmin::freeDOFIndex(int dof) {
FUNCNAME("DOFAdmin::freeDOFIndex");
FUNCNAME("DOFAdmin::freeDOFIndex()");
TEST_EXIT(usedCount > 0)("no dofs in use\n");
TEST_EXIT((dof >= 0)&&(dof < size))("invalid dof index %d\n",dof);
TEST_EXIT_DBG(usedCount > 0)("no dofs in use\n");
TEST_EXIT_DBG((dof >= 0) && (dof < size))("invalid dof index %d\n",dof);
::std::list<DOFIndexedBase*>::iterator di;
::std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
......@@ -107,30 +108,29 @@ namespace AMDiS {
int DOFAdmin::getDOFIndex()
{
FUNCNAME("DOFAdmin::getDOFIndex");
int i, dof = 0;
int dof = 0;
// if there is a hole
if (firstHole < static_cast<int>(dofFree.size())) {
TEST_EXIT(dofFree[firstHole])("no hole at firstHole!\n");
TEST_EXIT_DBG(dofFree[firstHole])("no hole at firstHole!\n");
// its no longer a hole
dofFree[firstHole] = false;
dof = firstHole;
// search new hole
int dfsize = static_cast<int>(dofFree.size());
for (i = firstHole+1; i < dfsize; i++) {
int i = 0;
for (i = firstHole + 1; i < dfsize; i++) {
if (dofFree[i]) {
break;
}
}
firstHole = i;
}
// if there is no hole
else {
} else { // if there is no hole
// enlarge dof-list
enlargeDOFLists(0);
TEST_EXIT(firstHole < static_cast<int>(dofFree.size()))
TEST_EXIT_DBG(firstHole < static_cast<int>(dofFree.size()))
("no free entry after enlargeDOFLists\n");
TEST_EXIT(dofFree[firstHole])
TEST_EXIT_DBG(dofFree[firstHole])
("no free bit at firstHole\n");
dofFree[firstHole] = false;
dof = firstHole;
......@@ -138,8 +138,9 @@ namespace AMDiS {
}
usedCount++;
if (holeCount > 0) holeCount--;
sizeUsed = max(sizeUsed, dof+1);
if (holeCount > 0)
holeCount--;
sizeUsed = max(sizeUsed, dof + 1);
return(dof);
}
......@@ -180,8 +181,8 @@ namespace AMDiS {
}
void DOFAdmin::addDOFIndexed(DOFIndexedBase* dofIndexed) {
FUNCNAME("DOFAdmin::addDOFIndexed");
TEST_EXIT(dofIndexed)("no dofIndexed\n");
FUNCNAME("DOFAdmin::addDOFIndexed()");
TEST_EXIT_DBG(dofIndexed)("no dofIndexed\n");
if (dofIndexed->getSize() < size) {
dofIndexed->resize(size);
......@@ -209,7 +210,7 @@ namespace AMDiS {
void DOFAdmin::addDOFContainer(DOFContainer* cont)
{
FUNCNAME("DOFAdmin::addDOFContainer()");
TEST_EXIT(cont)("no container\n");
TEST_EXIT_DBG(cont)("no container\n");
dofContainerList.push_back(cont);
}
......@@ -233,8 +234,8 @@ namespace AMDiS {
void DOFAdmin::compress(::std::vector<DegreeOfFreedom> &new_dof)
{
FUNCNAME("DOFAdmin::compress");
int i,n,first,last=0;
FUNCNAME("DOFAdmin::compress()");
int i,n,first,last=0;
// nothing to do ?
if (size < 1) return;
......@@ -258,7 +259,7 @@ namespace AMDiS {
}
}
TEST_EXIT(n == usedCount)("count %d != usedCount %d\n", n, usedCount);
TEST_EXIT_DBG(n == usedCount)("count %d != usedCount %d\n", n, usedCount);
// mark used dofs in compressed dofFree
for(i=0; i < n; i++) {
......@@ -303,19 +304,19 @@ namespace AMDiS {
}
const int DOFAdmin::getNumberOfPreDOFs(int i) const {
TEST_EXIT((0 <= i) && (4 > i))("");
TEST_EXIT_DBG((0 <= i) && (4 > i))("");
return nr0DOF[i];
}
void DOFAdmin::setNumberOfDOFs(int i,int v) {
TEST_EXIT((0 <= i) && (4 > i))("");
TEST_EXIT_DBG((0 <= i) && (4 > i))("");
nrDOF[i] = v;
}
void DOFAdmin::setNumberOfPreDOFs(int i, int v) {
TEST_EXIT((0 <= i) && (4 > i))("");
TEST_EXIT_DBG((0 <= i) && (4 > i))("");
nr0DOF[i] = v;
}
......
......@@ -318,7 +318,9 @@ namespace AMDiS {
int i, freeCol = -1, rowSize = static_cast<int>( row->size());
TEST_EXIT(jcol>=0&&jcol<colFESpace->getAdmin()->getUsedSize())("Column index %d out of range 0-%d\n",jcol,colFESpace->getAdmin()->getUsedSize()-1);
TEST_EXIT_DBG(jcol >= 0 &&
jcol < colFESpace->getAdmin()->getUsedSize())
("Column index %d out of range 0-%d\n", jcol, colFESpace->getAdmin()->getUsedSize() - 1);
// first entry is diagonal entry
if(rowFESpace==colFESpace)
......@@ -498,21 +500,18 @@ namespace AMDiS {
WARNING("implementation not finished!!!\n");
int i,j;
//TEST_EXIT(bTranspose == NoTranspose)("not yet for transposed matrix b");
TEST_EXIT(a.getColFESpace() == b.getRowFESpace())
TEST_EXIT_DBG(a.getColFESpace() == b.getRowFESpace())
("a.colFESpace != b.rowFESpace\n");
TEST_EXIT(rowFESpace == a.getRowFESpace())
TEST_EXIT_DBG(rowFESpace == a.getRowFESpace())
("rowFESpace != a.rowFESpace\n");
TEST_EXIT(colFESpace == b.getColFESpace())
TEST_EXIT_DBG(colFESpace == b.getColFESpace())
("colFESpace != b.colFESpace\n");
clear();
int i, j;
if(aTranspose == NoTranspose && bTranspose == NoTranspose) {
if (aTranspose == NoTranspose && bTranspose == NoTranspose) {
int cols = b.getColFESpace()->getAdmin()->getUsedSize();
DOFMatrix::Iterator rowIterator(this, USED_DOFS);
......@@ -562,40 +561,6 @@ namespace AMDiS {
}
}
} else if(aTranspose == NoTranspose && bTranspose == Transpose) {
// DOFMatrix::Iterator aIterator(&a, USED_DOFS);
// DOFMatrix::Iterator bIterator(&b, USED_DOFS);
// ::std::vector<MatEntry>::const_iterator aRowIt;
// ::std::vector<MatEntry>::const_iterator aRowBegin;
// ::std::vector<MatEntry>::const_iterator aRowEnd;
// ::std::vector<MatEntry>::const_iterator bRowIt;
// ::std::vector<MatEntry>::const_iterator bRowBegin;
// ::std::vector<MatEntry>::const_iterator bRowEnd;
// int row, col;
// for(aIterator.reset(); !aIterator.end(); ++aIterator) {
// row = aIterator.getDOFIndex();
// aRowBegin = aIterator->begin();