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

* On the way to independent meshes ...

parent b0afa1f1
...@@ -197,7 +197,6 @@ $(SOURCE_DIR)/ElInfo2d.cc \ ...@@ -197,7 +197,6 @@ $(SOURCE_DIR)/ElInfo2d.cc \
$(SOURCE_DIR)/ElInfo3d.cc \ $(SOURCE_DIR)/ElInfo3d.cc \
$(SOURCE_DIR)/FiniteElemSpace.cc \ $(SOURCE_DIR)/FiniteElemSpace.cc \
$(SOURCE_DIR)/FixVec.cc \ $(SOURCE_DIR)/FixVec.cc \
$(SOURCE_DIR)/Flag.cc \
$(SOURCE_DIR)/Global.cc \ $(SOURCE_DIR)/Global.cc \
$(SOURCE_DIR)/Lagrange.cc \ $(SOURCE_DIR)/Lagrange.cc \
$(SOURCE_DIR)/Line.cc \ $(SOURCE_DIR)/Line.cc \
......
...@@ -227,11 +227,11 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ ...@@ -227,11 +227,11 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/Element.cc $(SOURCE_DIR)/ElInfo1d.cc \ $(SOURCE_DIR)/Element.cc $(SOURCE_DIR)/ElInfo1d.cc \
$(SOURCE_DIR)/ElInfo2d.cc $(SOURCE_DIR)/ElInfo3d.cc \ $(SOURCE_DIR)/ElInfo2d.cc $(SOURCE_DIR)/ElInfo3d.cc \
$(SOURCE_DIR)/FiniteElemSpace.cc $(SOURCE_DIR)/FixVec.cc \ $(SOURCE_DIR)/FiniteElemSpace.cc $(SOURCE_DIR)/FixVec.cc \
$(SOURCE_DIR)/Flag.cc $(SOURCE_DIR)/Global.cc \ $(SOURCE_DIR)/Global.cc $(SOURCE_DIR)/Lagrange.cc \
$(SOURCE_DIR)/Lagrange.cc $(SOURCE_DIR)/Line.cc \ $(SOURCE_DIR)/Line.cc $(SOURCE_DIR)/MacroElement.cc \
$(SOURCE_DIR)/MacroElement.cc $(SOURCE_DIR)/MacroWriter.cc \ $(SOURCE_DIR)/MacroWriter.cc $(SOURCE_DIR)/Parameters.cc \
$(SOURCE_DIR)/Parameters.cc $(SOURCE_DIR)/Parametric.cc \ $(SOURCE_DIR)/Parametric.cc $(SOURCE_DIR)/Quadrature.cc \
$(SOURCE_DIR)/Quadrature.cc $(SOURCE_DIR)/RCNeighbourList.cc \ $(SOURCE_DIR)/RCNeighbourList.cc \
$(SOURCE_DIR)/RefinementManager.cc \ $(SOURCE_DIR)/RefinementManager.cc \
$(SOURCE_DIR)/RefinementManager1d.cc \ $(SOURCE_DIR)/RefinementManager1d.cc \
$(SOURCE_DIR)/RefinementManager2d.cc \ $(SOURCE_DIR)/RefinementManager2d.cc \
...@@ -303,11 +303,11 @@ am_libamdis_la_OBJECTS = $(am__objects_1) \ ...@@ -303,11 +303,11 @@ am_libamdis_la_OBJECTS = $(am__objects_1) \
libamdis_la-Element.lo libamdis_la-ElInfo1d.lo \ libamdis_la-Element.lo libamdis_la-ElInfo1d.lo \
libamdis_la-ElInfo2d.lo libamdis_la-ElInfo3d.lo \ libamdis_la-ElInfo2d.lo libamdis_la-ElInfo3d.lo \
libamdis_la-FiniteElemSpace.lo libamdis_la-FixVec.lo \ libamdis_la-FiniteElemSpace.lo libamdis_la-FixVec.lo \
libamdis_la-Flag.lo libamdis_la-Global.lo \ libamdis_la-Global.lo libamdis_la-Lagrange.lo \
libamdis_la-Lagrange.lo libamdis_la-Line.lo \ libamdis_la-Line.lo libamdis_la-MacroElement.lo \
libamdis_la-MacroElement.lo libamdis_la-MacroWriter.lo \ libamdis_la-MacroWriter.lo libamdis_la-Parameters.lo \
libamdis_la-Parameters.lo libamdis_la-Parametric.lo \ libamdis_la-Parametric.lo libamdis_la-Quadrature.lo \
libamdis_la-Quadrature.lo libamdis_la-RCNeighbourList.lo \ libamdis_la-RCNeighbourList.lo \
libamdis_la-RefinementManager.lo \ libamdis_la-RefinementManager.lo \
libamdis_la-RefinementManager1d.lo \ libamdis_la-RefinementManager1d.lo \
libamdis_la-RefinementManager2d.lo \ libamdis_la-RefinementManager2d.lo \
...@@ -640,7 +640,6 @@ $(SOURCE_DIR)/ElInfo2d.cc \ ...@@ -640,7 +640,6 @@ $(SOURCE_DIR)/ElInfo2d.cc \
$(SOURCE_DIR)/ElInfo3d.cc \ $(SOURCE_DIR)/ElInfo3d.cc \
$(SOURCE_DIR)/FiniteElemSpace.cc \ $(SOURCE_DIR)/FiniteElemSpace.cc \
$(SOURCE_DIR)/FixVec.cc \ $(SOURCE_DIR)/FixVec.cc \
$(SOURCE_DIR)/Flag.cc \
$(SOURCE_DIR)/Global.cc \ $(SOURCE_DIR)/Global.cc \
$(SOURCE_DIR)/Lagrange.cc \ $(SOURCE_DIR)/Lagrange.cc \
$(SOURCE_DIR)/Line.cc \ $(SOURCE_DIR)/Line.cc \
...@@ -804,7 +803,6 @@ distclean-compile: ...@@ -804,7 +803,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FiniteElemSpace.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FiniteElemSpace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FirstOrderAssembler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FirstOrderAssembler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FixVec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FixVec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Flag.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GNUPlotWriter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GNUPlotWriter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GSSmoother.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GSSmoother.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Global.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Global.Plo@am__quote@
...@@ -1487,13 +1485,6 @@ libamdis_la-FixVec.lo: $(SOURCE_DIR)/FixVec.cc ...@@ -1487,13 +1485,6 @@ libamdis_la-FixVec.lo: $(SOURCE_DIR)/FixVec.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-FixVec.lo `test -f '$(SOURCE_DIR)/FixVec.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/FixVec.cc @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-FixVec.lo `test -f '$(SOURCE_DIR)/FixVec.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/FixVec.cc
libamdis_la-Flag.lo: $(SOURCE_DIR)/Flag.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-Flag.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-Flag.Tpo" -c -o libamdis_la-Flag.lo `test -f '$(SOURCE_DIR)/Flag.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Flag.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-Flag.Tpo" "$(DEPDIR)/libamdis_la-Flag.Plo"; else rm -f "$(DEPDIR)/libamdis_la-Flag.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/Flag.cc' object='libamdis_la-Flag.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-Flag.lo `test -f '$(SOURCE_DIR)/Flag.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Flag.cc
libamdis_la-Global.lo: $(SOURCE_DIR)/Global.cc libamdis_la-Global.lo: $(SOURCE_DIR)/Global.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-Global.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-Global.Tpo" -c -o libamdis_la-Global.lo `test -f '$(SOURCE_DIR)/Global.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Global.cc; \ @am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-Global.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-Global.Tpo" -c -o libamdis_la-Global.lo `test -f '$(SOURCE_DIR)/Global.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Global.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-Global.Tpo" "$(DEPDIR)/libamdis_la-Global.Plo"; else rm -f "$(DEPDIR)/libamdis_la-Global.Tpo"; exit 1; fi @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-Global.Tpo" "$(DEPDIR)/libamdis_la-Global.Plo"; else rm -f "$(DEPDIR)/libamdis_la-Global.Tpo"; exit 1; fi
......
...@@ -80,102 +80,51 @@ namespace AMDiS { ...@@ -80,102 +80,51 @@ namespace AMDiS {
DegreeOfFreedom *dof[3]; DegreeOfFreedom *dof[3];
dof[0] = const_cast<int*>( el->getChild(0)->getDOF(2)); dof[0] = const_cast<int*>( el->getChild(0)->getDOF(2));
if (mesh->getNumberOfDOFs(EDGE)) if (mesh->getNumberOfDOFs(EDGE)) {
{
dof[1] = const_cast<int*>( el->getChild(0)->getDOF(3)); dof[1] = const_cast<int*>( el->getChild(0)->getDOF(3));
dof[2] = const_cast<int*>( el->getChild(1)->getDOF(4)); dof[2] = const_cast<int*>( el->getChild(1)->getDOF(4));
} }
int node = mesh->getNode(EDGE); int node = mesh->getNode(EDGE);
if (mesh->getNumberOfDOFs(EDGE)) if (mesh->getNumberOfDOFs(EDGE)) {
{
/****************************************************************************/ /****************************************************************************/
/* get new dof on el at the midpoint of the coarsening edge */ /* get new dof on el at the midpoint of the coarsening edge */
/****************************************************************************/ /****************************************************************************/
if (!el->getDOF(node+2)) if (!el->getDOF(node+2)) {
{
el->setDOF(node+2, mesh->getDOF(EDGE)); el->setDOF(node+2, mesh->getDOF(EDGE));
if (neigh) { if (neigh) {
// // periodic boundary ?
// if(el->getDOF(0) != neigh->getDOF(0) &&
// el->getDOF(1) != neigh->getDOF(0))
// {
// neigh->setDOF(node+2, mesh->getDOF(EDGE));
// } else {
neigh->setDOF(node+2, const_cast<int*>( el->getDOF(node+2))); neigh->setDOF(node+2, const_cast<int*>( el->getDOF(node+2)));
// }
} }
} }
} }
// // periodic boundary?
// DegreeOfFreedom *neighDOF[3] = {NULL, NULL, NULL};
// RCNeighbourList *periodicCoarsenList = NULL;
// int n_neigh_periodic;
// if(neigh &&
// (neigh->getDOF(0) != el->getDOF(1)) &&
// (neigh->getDOF(0) != el->getDOF(0)))
// {
// neighDOF[0] = const_cast<int*>(neigh->getChild(0)->getDOF(2));
// if (mesh->getNumberOfDOFs(EDGE)) {
// neighDOF[1] = const_cast<int*>(neigh->getChild(0)->getDOF(3));
// neighDOF[2] = const_cast<int*>(neigh->getChild(1)->getDOF(4));
// if (!neigh->getDOF(node+2)) {
// neigh->setDOF(node+2, mesh->getDOF(EDGE));
// }
// }
// DegreeOfFreedom *edge[2] = {
// const_cast<DegreeOfFreedom*>(el->getDOF(0)),
// const_cast<DegreeOfFreedom*>(el->getDOF(1))
// };
// DegreeOfFreedom *periodicEdge[2] = {
// const_cast<DegreeOfFreedom*>(neigh->getDOF(0)),
// const_cast<DegreeOfFreedom*>(neigh->getDOF(1))
// };
// periodicCoarsenList = coarsenList->periodicSplit(edge,
// &n_neigh,
// periodicEdge,
// &n_neigh_periodic);
// }
if (mesh->getNumberOfDOFs(EDGE) || mesh->getNumberOfDOFs(CENTER)) { if (mesh->getNumberOfDOFs(EDGE) || mesh->getNumberOfDOFs(CENTER)) {
coarsenList->addDOFParents(n_neigh); coarsenList->addDOFParents(n_neigh);
// if(periodicCoarsenList) {
// periodicCoarsenList->addDOFParents(n_neigh_periodic);
// }
} }
/****************************************************************************/ /****************************************************************************/
/* restrict dof vectors to the parents on the patch */ /* restrict dof vectors to the parents on the patch */
/****************************************************************************/ /****************************************************************************/
int iadmin;
int nrAdmin = mesh->getNumberOfDOFAdmin(); int nrAdmin = mesh->getNumberOfDOFAdmin();
for(iadmin = 0; iadmin < nrAdmin; iadmin++) { for (int iadmin = 0; iadmin < nrAdmin; iadmin++) {
std::list<DOFIndexedBase*>::iterator it; std::list<DOFIndexedBase*>::iterator it;
DOFAdmin* admin = const_cast<DOFAdmin*>(&mesh->getDOFAdmin(iadmin)); DOFAdmin* admin = const_cast<DOFAdmin*>(&mesh->getDOFAdmin(iadmin));
std::list<DOFIndexedBase*>::iterator end = admin->endDOFIndexed(); std::list<DOFIndexedBase*>::iterator end = admin->endDOFIndexed();
for(it = admin->beginDOFIndexed(); it != end; ++it) { for (it = admin->beginDOFIndexed(); it != end; ++it) {
(*it)->coarseRestrict(*coarsenList, n_neigh); (*it)->coarseRestrict(*coarsenList, n_neigh);
// if(periodicCoarsenList) {
// (*it)->coarseRestrict(*periodicCoarsenList, n_neigh_periodic);
// }
} }
} }
// if(periodicCoarsenList) DELETE periodicCoarsenList;
coarsenTriangle(el); coarsenTriangle(el);
if (neigh) coarsenTriangle(neigh); if (neigh)
coarsenTriangle(neigh);
/****************************************************************************/ /****************************************************************************/
/* now, remove those dofs in the coarcening edge */ /* now, remove those dofs in the coarcening edge */
/****************************************************************************/ /****************************************************************************/
mesh->freeDOF(dof[0], VERTEX); mesh->freeDOF(dof[0], VERTEX);
if (mesh->getNumberOfDOFs(EDGE)) if (mesh->getNumberOfDOFs(EDGE)) {
{
mesh->freeDOF(dof[1], EDGE); mesh->freeDOF(dof[1], EDGE);
mesh->freeDOF(dof[2], EDGE); mesh->freeDOF(dof[2], EDGE);
} }
...@@ -183,20 +132,6 @@ namespace AMDiS { ...@@ -183,20 +132,6 @@ namespace AMDiS {
mesh->incrementNumberOfVertices(-1); mesh->incrementNumberOfVertices(-1);
mesh->incrementNumberOfEdges(-1); mesh->incrementNumberOfEdges(-1);
// // periodic boundary?
// if(neigh &&
// (neigh->getDOF(0) != el->getDOF(1)) &&
// (neigh->getDOF(0) != el->getDOF(0)))
// {
// mesh->freeDOF(neighDOF[0], VERTEX);
// if (mesh->getNumberOfDOFs(EDGE)) {
// mesh->freeDOF(neighDOF[1], EDGE);
// mesh->freeDOF(neighDOF[2], EDGE);
// }
// mesh->incrementNumberOfVertices(-1);
// mesh->incrementNumberOfEdges(-1);
// }
return; return;
} }
......
...@@ -86,20 +86,21 @@ namespace AMDiS { ...@@ -86,20 +86,21 @@ namespace AMDiS {
std::list<DOFIndexedBase*>::iterator di; std::list<DOFIndexedBase*>::iterator di;
std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for(di = dofIndexedList.begin(); di != end; ++di) { for (di = dofIndexedList.begin(); di != end; ++di) {
(*di)->freeDOFContent(dof); (*di)->freeDOFContent(dof);
} }
std::list<DOFContainer*>::iterator dc; std::list<DOFContainer*>::iterator dc;
std::list<DOFContainer*>::iterator dcend = dofContainerList.end(); std::list<DOFContainer*>::iterator dcend = dofContainerList.end();
for(dc = dofContainerList.begin(); dc != dcend; ++dc) { for (dc = dofContainerList.begin(); dc != dcend; ++dc) {
(*dc)->freeDOFIndex(dof); (*dc)->freeDOFIndex(dof);
} }
dofFree[dof] = true; dofFree[dof] = true;
if (static_cast<int>(firstHole) > dof) firstHole = dof; if (static_cast<int>(firstHole) > dof)
firstHole = dof;
usedCount--; usedCount--;
holeCount++; holeCount++;
...@@ -109,7 +110,7 @@ namespace AMDiS { ...@@ -109,7 +110,7 @@ namespace AMDiS {
int DOFAdmin::getDOFIndex() int DOFAdmin::getDOFIndex()
{ {
FUNCNAME("DOFAdmin::getDOFIndex"); FUNCNAME("DOFAdmin::getDOFIndex()");
int dof = 0; int dof = 0;
// if there is a hole // if there is a hole
...@@ -120,8 +121,8 @@ namespace AMDiS { ...@@ -120,8 +121,8 @@ namespace AMDiS {
dof = firstHole; dof = firstHole;
// search new hole // search new hole
int dfsize = static_cast<int>(dofFree.size()); int dfsize = static_cast<int>(dofFree.size());
int i = 0; int i = firstHole + 1;
for (i = firstHole + 1; i < dfsize; i++) { for (; i < dfsize; i++) {
if (dofFree[i]) { if (dofFree[i]) {
break; break;
} }
...@@ -152,7 +153,7 @@ namespace AMDiS { ...@@ -152,7 +153,7 @@ namespace AMDiS {
void DOFAdmin::enlargeDOFLists(int minsize) void DOFAdmin::enlargeDOFLists(int minsize)
{ {
FUNCNAME("DOFAdmin::enlargeDOFLists"); FUNCNAME("DOFAdmin::enlargeDOFLists()");
int old = size; int old = size;
if (minsize > 0) { if (minsize > 0) {
......
...@@ -271,12 +271,16 @@ namespace AMDiS { ...@@ -271,12 +271,16 @@ namespace AMDiS {
/** \brief /** \brief
* Sets \ref name = n * Sets \ref name = n
*/ */
inline void setName(const std::string& n) { name = n; }; inline void setName(const std::string& n) {
name = n;
};
/** \brief /** \brief
* Sets \ref mesh = m * Sets \ref mesh = m
*/ */
inline void setMesh(Mesh* m) { mesh = m; }; inline void setMesh(Mesh* m) {
mesh = m;
};
/** \} */ /** \} */
......
...@@ -69,7 +69,7 @@ namespace AMDiS { ...@@ -69,7 +69,7 @@ namespace AMDiS {
return false; return false;
} }
rest_ = 1.0; rest = 1.0;
bool accepted = check(elInfo1, elInfo2, bool accepted = check(elInfo1, elInfo2,
elInfoSmall, elInfoLarge); elInfoSmall, elInfoLarge);
...@@ -83,6 +83,8 @@ namespace AMDiS { ...@@ -83,6 +83,8 @@ namespace AMDiS {
return traverseNext(elInfo1, elInfo2, elInfoSmall, elInfoLarge); return traverseNext(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
} }
fillSubElInfo(*elInfo1, *elInfo2, *elInfoSmall, *elInfoLarge);
return true; return true;
} }
...@@ -92,12 +94,12 @@ namespace AMDiS { ...@@ -92,12 +94,12 @@ namespace AMDiS {
ElInfo **elInfoLarge) ElInfo **elInfoLarge)
{ {
// call standard traverse // call standard traverse
if (inc1_) { if (inc1) {
do { do {
*elInfo1 = stack1.traverseNext(*elInfo1); *elInfo1 = stack1.traverseNext(*elInfo1);
} while(*elInfo1 != NULL && skipEl1(*elInfo1)); } while (*elInfo1 != NULL && skipEl1(*elInfo1));
} }
if (inc2_) { if (inc2) {
do { do {
*elInfo2 = stack2.traverseNext(*elInfo2); *elInfo2 = stack2.traverseNext(*elInfo2);
} while (*elInfo2 != NULL && skipEl2(*elInfo2)); } while (*elInfo2 != NULL && skipEl2(*elInfo2));
...@@ -121,6 +123,8 @@ namespace AMDiS { ...@@ -121,6 +123,8 @@ namespace AMDiS {
return traverseNext(elInfo1, elInfo2, elInfoSmall, elInfoLarge); return traverseNext(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
} }
fillSubElInfo(*elInfo1, *elInfo2, *elInfoSmall, *elInfoLarge);
return true; return true;
} }
...@@ -139,22 +143,39 @@ namespace AMDiS { ...@@ -139,22 +143,39 @@ namespace AMDiS {
*elInfo1 : *elInfo1 :
*elInfo2; *elInfo2;
int smallLevel = (*elInfoSmall)->getLevel();
int largeLevel = (*elInfoLarge)->getLevel();
// update rest // update rest
rest_ -= 1.0 / (1 << (smallLevel - largeLevel)); rest -= 1.0 / (1 << ((*elInfoSmall)->getLevel() - (*elInfoLarge)->getLevel()));
if (rest_ < 1e-32) { if (rest < 1e-32) {
// large element finished -> increment both elements // large element finished -> increment both elements
rest_ = 1.0; rest = 1.0;
inc1_ = true; inc1 = true;
inc2_ = true; inc2 = true;
} else { } else {
// increment only small element // increment only small element
inc1_ = (*elInfo1 == *elInfoSmall) ? true : false; inc1 = (*elInfo1 == *elInfoSmall) ? true : false;
inc2_ = (*elInfo2 == *elInfoSmall) ? true : false; inc2 = (*elInfo2 == *elInfoSmall) ? true : false;
} }
} }
void DualTraverse::fillSubElInfo(ElInfo *elInfo1,
ElInfo *elInfo2,
ElInfo *elInfoSmall,
ElInfo *elInfoLarge)
{
if (!fillSubElemInfo)
return;
VectorOfFixVecs<DimVec<double> > *subCoords = elInfoSmall->getSubElemCoords();
if (!subCoords) {
subCoords = NEW VectorOfFixVecs<DimVec<double> >(1, 2, NO_INIT);
}
if (elInfo1 == elInfoSmall) {
stack1.getCoordsInElem(elInfo2, subCoords);
} else {
stack2.getCoordsInElem(elInfo1, subCoords);
}
elInfoSmall->setSubElemCoords(subCoords);
}
} }
...@@ -43,7 +43,11 @@ namespace AMDiS { ...@@ -43,7 +43,11 @@ namespace AMDiS {
public: public:
MEMORY_MANAGED(DualTraverse); MEMORY_MANAGED(DualTraverse);
virtual ~DualTraverse() {}; DualTraverse()
: fillSubElemInfo(false)
{};
~DualTraverse() {};
/** \brief /** \brief
* Start dual traversal * Start dual traversal
...@@ -67,22 +71,26 @@ namespace AMDiS { ...@@ -67,22 +71,26 @@ namespace AMDiS {
ElInfo **elInfoSmall, ElInfo **elInfoSmall,
ElInfo **elInfoLarge); ElInfo **elInfoLarge);
virtual bool skipEl1(ElInfo *elInfo) { bool skipEl1(ElInfo *elInfo) {
return false; return false;
}; }
virtual bool skipEl2(ElInfo *elInfo) { bool skipEl2(ElInfo *elInfo) {
return false; return false;
}; }
virtual bool check(ElInfo **elInfo1, bool check(ElInfo **elInfo1,
ElInfo **elInfo2, ElInfo **elInfo2,
ElInfo **elInfoSmall, ElInfo **elInfoSmall,
ElInfo **elInfoLarge) ElInfo **elInfoLarge)
{ {
prepareNextStep(elInfo1, elInfo2, elInfoSmall, elInfoLarge); prepareNextStep(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
return true; return true;
}; }
inline void setFillSubElemInfo(bool b) {
fillSubElemInfo = b;
}
protected: protected:
/** \brief /** \brief
...@@ -94,6 +102,11 @@ namespace AMDiS { ...@@ -94,6 +102,11 @@ namespace AMDiS {
ElInfo **elInfoSmall, ElInfo **elInfoSmall,
ElInfo **elInfoLarge); ElInfo **elInfoLarge);
void fillSubElInfo(ElInfo *elInfo1,
ElInfo *elInfo2,
ElInfo *elInfoSmall,
ElInfo *elInfoLarge);
protected: protected:
/** \brief /** \brief
* stack for mesh 1 * stack for mesh 1
...@@ -109,17 +122,17 @@ namespace AMDiS { ...@@ -109,17 +122,17 @@ namespace AMDiS {
* used to determine whether all small elements belonging to the large * used to determine whether all small elements belonging to the large
* element are traversed. * element are traversed.
*/ */
double rest_; double rest;
/** \brief /** \brief
* true is element 1 should be incremented (set in prepareNextStep()) * true is element 1 should be incremented (set in prepareNextStep())
*/ */
bool inc1_; bool inc1;
/** \brief /** \brief
* true is element 2 should be incremented (set in prepareNextStep()) * true is element 2 should be incremented (set in prepareNextStep())
*/ */
bool inc2_; bool inc2;
/** \brief /** \brief
* for level traverse of mesh 1 * for level traverse of mesh 1
...@@ -140,6 +153,8 @@ namespace AMDiS { ...