Commit 4626656b authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Okay, ab ins Wochenende.

parent 5e000286
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
void HL_SignedDistTraverse::initializeBoundary() void HL_SignedDistTraverse::initializeBoundary()
{ {
FUNCNAME("HL_SignedDistTraverse::initializeBoundary()"); FUNCNAME("HL_SignedDistTraverse::initializeBoundary()");
// ===== All non-boundary vertices are initialized with "infinity". ===== // ===== All non-boundary vertices are initialized with "infinity". =====
sD_DOF->set(inftyValue); sD_DOF->set(inftyValue);
......
...@@ -8,7 +8,7 @@ namespace AMDiS { ...@@ -8,7 +8,7 @@ namespace AMDiS {
void AdaptInfo::setScalContents(int newSize) void AdaptInfo::setScalContents(int newSize)
{ {
int oldSize = scalContents.getSize(); int oldSize = static_cast<int>(scalContents.size());
if (newSize > oldSize) { if (newSize > oldSize) {
scalContents.resize(newSize); scalContents.resize(newSize);
...@@ -42,7 +42,7 @@ namespace AMDiS { ...@@ -42,7 +42,7 @@ namespace AMDiS {
SerUtil::serialize(out, solverTolerance); SerUtil::serialize(out, solverTolerance);
SerUtil::serialize(out, solverResidual); SerUtil::serialize(out, solverResidual);
int size = scalContents.getSize(); int size = static_cast<int>(scalContents.size());
SerUtil::serialize(out, size); SerUtil::serialize(out, size);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
SerUtil::serialize(out, scalContents[i]->est_sum); SerUtil::serialize(out, scalContents[i]->est_sum);
......
...@@ -171,8 +171,9 @@ namespace AMDiS { ...@@ -171,8 +171,9 @@ namespace AMDiS {
} }
/// Destructor. /// Destructor.
virtual ~AdaptInfo() { virtual ~AdaptInfo()
for (int i = 0; i < scalContents.getSize(); i++) {
for (unsigned int i = 0; i < scalContents.size(); i++)
delete scalContents[i]; delete scalContents[i];
} }
...@@ -193,10 +194,10 @@ namespace AMDiS { ...@@ -193,10 +194,10 @@ namespace AMDiS {
/// Returns whether space tolerance is reached. /// Returns whether space tolerance is reached.
virtual bool spaceToleranceReached() virtual bool spaceToleranceReached()
{ {
int size = scalContents.getSize(); for (unsigned int i = 0; i < scalContents.size(); i++) {
for (int i = 0; i < size; i++) std::cout << "est_sum:" <<scalContents[i]->est_sum
{ << " spaceTol: " << scalContents[i]->spaceTolerance
std::cout<<"est_sum:"<<scalContents[i]->est_sum<<" spaceTol:"<<scalContents[i]->spaceTolerance<<std::endl; << std::endl;
if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance)) if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance))
return false; return false;
} }
...@@ -216,8 +217,7 @@ namespace AMDiS { ...@@ -216,8 +217,7 @@ namespace AMDiS {
/// Returns whether time tolerance is reached. /// Returns whether time tolerance is reached.
virtual bool timeToleranceReached() virtual bool timeToleranceReached()
{ {
int size = scalContents.getSize(); for (unsigned int i = 0; i < scalContents.size(); i++)
for (int i = 0; i < size; i++)
if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance)) if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance))
return false; return false;
...@@ -236,8 +236,7 @@ namespace AMDiS { ...@@ -236,8 +236,7 @@ namespace AMDiS {
/// Returns whether time error is under its lower bound. /// Returns whether time error is under its lower bound.
virtual bool timeErrorLow() virtual bool timeErrorLow()
{ {
int size = scalContents.getSize(); for (unsigned int i = 0; i < scalContents.size(); i++)
for (int i = 0; i < size; i++)
if (!(scalContents[i]->est_t_sum < scalContents[i]->timeErrLow)) if (!(scalContents[i]->est_t_sum < scalContents[i]->timeErrLow))
return false; return false;
...@@ -247,7 +246,7 @@ namespace AMDiS { ...@@ -247,7 +246,7 @@ namespace AMDiS {
/// Print debug information about time error and its bound. /// Print debug information about time error and its bound.
void printTimeErrorLowInfo() void printTimeErrorLowInfo()
{ {
for (int i = 0; i < scalContents.getSize(); i++) for (unsigned int i = 0; i < scalContents.size(); i++)
std::cout << " Time error estimate = " << scalContents[i]->est_t_sum std::cout << " Time error estimate = " << scalContents[i]->est_t_sum
<< " Time error bound = " << scalContents[i]->timeErrLow << "\n"; << " Time error bound = " << scalContents[i]->timeErrLow << "\n";
} }
...@@ -387,6 +386,11 @@ namespace AMDiS { ...@@ -387,6 +386,11 @@ namespace AMDiS {
/// Returns \ref est_sum. /// Returns \ref est_sum.
inline double getEstSum(int index) inline double getEstSum(int index)
{ {
FUNCNAME("AdaptInfo::getEstSum()");
TEST_EXIT_DBG(static_cast<unsigned int>(index) < scalContents.size())
("Wrong index for adaptInfo!\n");
return scalContents[index]->est_sum; return scalContents[index]->est_sum;
} }
...@@ -399,6 +403,11 @@ namespace AMDiS { ...@@ -399,6 +403,11 @@ namespace AMDiS {
/// Returns \ref est_max. /// Returns \ref est_max.
inline double getEstMax(int index) inline double getEstMax(int index)
{ {
FUNCNAME("AdaptInfo::getEstSum()");
TEST_EXIT_DBG(static_cast<unsigned int>(index) < scalContents.size())
("Wrong index for adaptInfo!\n");
return scalContents[index]->est_max; return scalContents[index]->est_max;
} }
...@@ -586,7 +595,7 @@ namespace AMDiS { ...@@ -586,7 +595,7 @@ namespace AMDiS {
inline int getSize() inline int getSize()
{ {
return scalContents.getSize(); return scalContents.size();
} }
inline void setSolverIterations(int it) inline void setSolverIterations(int it)
...@@ -728,7 +737,7 @@ namespace AMDiS { ...@@ -728,7 +737,7 @@ namespace AMDiS {
double solverResidual; double solverResidual;
/// Scalar adapt infos. /// Scalar adapt infos.
Vector<ScalContent*> scalContents; std::vector<ScalContent*> scalContents;
/// Is true, if the adaptive procedure was deserialized from a file. /// Is true, if the adaptive procedure was deserialized from a file.
bool isDeserialized_; bool isDeserialized_;
......
...@@ -135,12 +135,12 @@ namespace AMDiS { ...@@ -135,12 +135,12 @@ namespace AMDiS {
ElementMatrix &m = ElementMatrix &m =
smallElInfo->getSubElemCoordsMat(rowFESpace->getBasisFcts()->getDegree()); smallElInfo->getSubElemCoordsMat(rowFESpace->getBasisFcts()->getDegree());
if (smallElInfo == colElInfo) if (smallElInfo == colElInfo)
tmpMat = m * mat; tmpMat = m * mat;
else else
tmpMat = mat * trans(m); tmpMat = mat * trans(m);
mat = tmpMat; mat = tmpMat;
} }
if (rememberElMat && &userMat != &elementMatrix) if (rememberElMat && &userMat != &elementMatrix)
......
...@@ -246,14 +246,14 @@ namespace AMDiS { ...@@ -246,14 +246,14 @@ namespace AMDiS {
ERROR("container not in list\n"); ERROR("container not in list\n");
} }
void DOFAdmin::compress(std::vector<DegreeOfFreedom> &new_dof) void DOFAdmin::compress(std::vector<DegreeOfFreedom> &new_dof)
{ {
FUNCNAME("DOFAdmin::compress()"); FUNCNAME("DOFAdmin::compress()");
// nothing to do ? // nothing to do ?
if (size < 1) return; if (size < 1 || usedCount < 1 || holeCount < 1)
if (usedCount < 1) return; return;
if (holeCount < 1) return;
// vector to mark used dofs // vector to mark used dofs
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
...@@ -289,7 +289,7 @@ namespace AMDiS { ...@@ -289,7 +289,7 @@ namespace AMDiS {
// get index of first changed dof // get index of first changed dof
int first = last; int first = last;
for (int i = 0; i<size; i++) { for (int i = 0; i<size; i++) {
if ((new_dof[i] < i) && (new_dof[i] >= 0)) { if (new_dof[i] < i && new_dof[i] >= 0) {
first = i; first = i;
break; break;
} }
...@@ -307,6 +307,7 @@ namespace AMDiS { ...@@ -307,6 +307,7 @@ namespace AMDiS {
(*dc)->compressDOFContainer(n, new_dof); (*dc)->compressDOFContainer(n, new_dof);
} }
void DOFAdmin::setNumberOfDOFs(int i, int v) void DOFAdmin::setNumberOfDOFs(int i, int v)
{ {
FUNCNAME("DOFAdmin::setNumberOfDOFs()"); FUNCNAME("DOFAdmin::setNumberOfDOFs()");
......
...@@ -345,6 +345,7 @@ namespace AMDiS { ...@@ -345,6 +345,7 @@ namespace AMDiS {
addElementMatrix(elementMatrix, bound, mainElInfo, NULL); addElementMatrix(elementMatrix, bound, mainElInfo, NULL);
} }
void DOFMatrix::finishAssembling() void DOFMatrix::finishAssembling()
{ {
// call the operatos cleanup procedures // call the operatos cleanup procedures
...@@ -353,6 +354,7 @@ namespace AMDiS { ...@@ -353,6 +354,7 @@ namespace AMDiS {
(*it)->finishAssembling(); (*it)->finishAssembling();
} }
// Should work as before // Should work as before
Flag DOFMatrix::getAssembleFlag() Flag DOFMatrix::getAssembleFlag()
{ {
...@@ -364,6 +366,7 @@ namespace AMDiS { ...@@ -364,6 +366,7 @@ namespace AMDiS {
return fillFlag; return fillFlag;
} }
void DOFMatrix::axpy(double a, const DOFMatrix& x, const DOFMatrix& y) void DOFMatrix::axpy(double a, const DOFMatrix& x, const DOFMatrix& y)
{ {
matrix+= a * x.matrix + y.matrix; matrix+= a * x.matrix + y.matrix;
...@@ -375,6 +378,7 @@ namespace AMDiS { ...@@ -375,6 +378,7 @@ namespace AMDiS {
matrix*= b; matrix*= b;
} }
void DOFMatrix::addOperator(Operator *op, double* factor, double* estFactor) void DOFMatrix::addOperator(Operator *op, double* factor, double* estFactor)
{ {
operators.push_back(op); operators.push_back(op);
...@@ -382,6 +386,7 @@ namespace AMDiS { ...@@ -382,6 +386,7 @@ namespace AMDiS {
operatorEstFactor.push_back(estFactor); operatorEstFactor.push_back(estFactor);
} }
void DOFMatrix::serialize(std::ostream &out) void DOFMatrix::serialize(std::ostream &out)
{ {
using namespace mtl; using namespace mtl;
......
...@@ -829,6 +829,7 @@ namespace AMDiS { ...@@ -829,6 +829,7 @@ namespace AMDiS {
addElementVector(factor, this->elementVector, bound, elInfo); addElementVector(factor, this->elementVector, bound, elInfo);
} }
template<> template<>
void DOFVectorBase<double>::assemble2(double factor, void DOFVectorBase<double>::assemble2(double factor,
ElInfo *mainElInfo, ElInfo *auxElInfo, ElInfo *mainElInfo, ElInfo *auxElInfo,
......
...@@ -260,7 +260,7 @@ namespace AMDiS { ...@@ -260,7 +260,7 @@ namespace AMDiS {
void Element::newDOFFct2(const DOFAdmin* admin) void Element::newDOFFct2(const DOFAdmin* admin)
{ {
int i, j, k, n0, nd0; int j, k, n0, nd0;
DegreeOfFreedom *ldof; DegreeOfFreedom *ldof;
int vertices = mesh->getGeo(VERTEX); int vertices = mesh->getGeo(VERTEX);
int edges = mesh->getGeo(EDGE); int edges = mesh->getGeo(EDGE);
...@@ -270,7 +270,7 @@ namespace AMDiS { ...@@ -270,7 +270,7 @@ namespace AMDiS {
if (nd) { if (nd) {
nd0 = admin->getNumberOfPreDOFs(VERTEX); nd0 = admin->getNumberOfPreDOFs(VERTEX);
n0 = admin->getMesh()->getNode(VERTEX); n0 = admin->getMesh()->getNode(VERTEX);
for (i = 0; i < vertices; i++) { for (int i = 0; i < vertices; i++) {
CHANGE_DOFS_2(this); CHANGE_DOFS_2(this);
} }
} }
...@@ -280,7 +280,7 @@ namespace AMDiS { ...@@ -280,7 +280,7 @@ namespace AMDiS {
if (nd) { if (nd) {
nd0 = admin->getNumberOfPreDOFs(EDGE); nd0 = admin->getNumberOfPreDOFs(EDGE);
n0 = admin->getMesh()->getNode(EDGE); n0 = admin->getMesh()->getNode(EDGE);
for (i = 0; i < edges; i++) { for (int i = 0; i < edges; i++) {
CHANGE_DOFS_2(this); CHANGE_DOFS_2(this);
} }
} }
...@@ -291,7 +291,7 @@ namespace AMDiS { ...@@ -291,7 +291,7 @@ namespace AMDiS {
if (nd) { if (nd) {
nd0 = admin->getNumberOfPreDOFs(FACE); nd0 = admin->getNumberOfPreDOFs(FACE);
n0 = admin->getMesh()->getNode(FACE); n0 = admin->getMesh()->getNode(FACE);
for (i = 0; i < faces; i++) { for (int i = 0; i < faces; i++) {
CHANGE_DOFS_2(this); CHANGE_DOFS_2(this);
} }
} }
...@@ -302,7 +302,7 @@ namespace AMDiS { ...@@ -302,7 +302,7 @@ namespace AMDiS {
nd0 = admin->getNumberOfPreDOFs(CENTER); nd0 = admin->getNumberOfPreDOFs(CENTER);
n0 = admin->getMesh()->getNode(CENTER); n0 = admin->getMesh()->getNode(CENTER);
// only one center // only one center
i = 0; int i = 0;
CHANGE_DOFS_2(this); CHANGE_DOFS_2(this);
} }
} }
......
...@@ -35,7 +35,7 @@ namespace AMDiS { ...@@ -35,7 +35,7 @@ namespace AMDiS {
{ {
FUNCNAME("Marker::initMarking()"); FUNCNAME("Marker::initMarking()");
TEST_EXIT(adaptInfo)("No AdaptInfo object!\n"); TEST_EXIT_DBG(adaptInfo)("No AdaptInfo object!\n");
elMarkRefine = 0; elMarkRefine = 0;
elMarkCoarsen = 0; elMarkCoarsen = 0;
...@@ -70,8 +70,12 @@ namespace AMDiS { ...@@ -70,8 +70,12 @@ namespace AMDiS {
Flag Marker::markMesh(AdaptInfo *adaptInfo, Mesh *mesh) Flag Marker::markMesh(AdaptInfo *adaptInfo, Mesh *mesh)
{ {
FUNCNAME("Marker::markMesh()");
TEST_EXIT_DBG(mesh)("No mesh!\n");
initMarking(adaptInfo, mesh); initMarking(adaptInfo, mesh);
if (!adaptInfo->isCoarseningAllowed(row == -1 ? 0 : row) && if (!adaptInfo->isCoarseningAllowed(row == -1 ? 0 : row) &&
!adaptInfo->isRefinementAllowed(row == -1 ? 0 : row)) !adaptInfo->isRefinementAllowed(row == -1 ? 0 : row))
return 0; return 0;
...@@ -100,7 +104,7 @@ namespace AMDiS { ...@@ -100,7 +104,7 @@ namespace AMDiS {
FUNCNAME("ESMarker::initMarking()"); FUNCNAME("ESMarker::initMarking()");
Marker::initMarking(adaptInfo, mesh); Marker::initMarking(adaptInfo, mesh);
double ESThetaP = pow(ESTheta, p); double ESThetaP = pow(ESTheta, p);
double ESThetaCP = pow(ESThetaC, p); double ESThetaCP = pow(ESThetaC, p);
......
...@@ -63,7 +63,6 @@ namespace AMDiS { ...@@ -63,7 +63,6 @@ namespace AMDiS {
// const Flag Mesh::USE_PARAMETRIC = 0X8000L ; // used in mg methods // const Flag Mesh::USE_PARAMETRIC = 0X8000L ; // used in mg methods
DOFAdmin* Mesh::compressAdmin = NULL;
std::vector<DegreeOfFreedom> Mesh::dof_used; std::vector<DegreeOfFreedom> Mesh::dof_used;
const int Mesh::MAX_DOF = 100; const int Mesh::MAX_DOF = 100;
std::map<std::pair<DegreeOfFreedom, int>, DegreeOfFreedom*> Mesh::serializedDOFs; std::map<std::pair<DegreeOfFreedom, int>, DegreeOfFreedom*> Mesh::serializedDOFs;
...@@ -432,46 +431,39 @@ namespace AMDiS { ...@@ -432,46 +431,39 @@ namespace AMDiS {
nNodeEl += 1; nNodeEl += 1;
} }
void Mesh::dofCompress() void Mesh::dofCompress()
{ {
FUNCNAME("Mesh::dofCompress()"); FUNCNAME("Mesh::dofCompress()");
Flag fill_flag;
for (int iadmin = 0; iadmin < static_cast<int>(admin.size()); iadmin++) { for (unsigned int iadmin = 0; iadmin < admin.size(); iadmin++) {
compressAdmin = admin[iadmin]; DOFAdmin* compressAdmin = admin[iadmin];
TEST_EXIT_DBG(compressAdmin)("no admin[%d] in mesh\n", iadmin); TEST_EXIT_DBG(compressAdmin)("no admin[%d] in mesh\n", iadmin);
int size = compressAdmin->getSize(); int size = compressAdmin->getSize();
if (size < 1) if (size < 1 ||
continue; compressAdmin->getUsedDOFs() < 1 ||
compressAdmin->getHoleCount() < 1)
if (compressAdmin->getUsedDOFs() < 1)
continue; continue;
if (compressAdmin->getHoleCount() < 1)
continue;
newDOF.resize(size); newDOF.resize(size);
compressAdmin->compress(newDOF); compressAdmin->compress(newDOF);
if (preserveCoarseDOFs) Flag fill_flag = (preserveCoarseDOFs ?
fill_flag = Mesh::CALL_EVERY_EL_PREORDER | Mesh::FILL_NOTHING; Mesh::CALL_EVERY_EL_PREORDER | Mesh::FILL_NOTHING :
else Mesh::CALL_LEAF_EL | Mesh::FILL_NOTHING);
fill_flag = Mesh::CALL_LEAF_EL | Mesh::FILL_NOTHING;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(this, -1, fill_flag); ElInfo *elInfo = stack.traverseFirst(this, -1, fill_flag);
while (elInfo) { while (elInfo) {
newDOFFct1(elInfo); elInfo->getElement()->newDOFFct1(compressAdmin);
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
} }
elInfo = stack.traverseFirst(this, -1, fill_flag); elInfo = stack.traverseFirst(this, -1, fill_flag);
while (elInfo) { while (elInfo) {
newDOFFct2(elInfo); elInfo->getElement()->newDOFFct2(compressAdmin);
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
} }
...@@ -941,18 +933,6 @@ namespace AMDiS { ...@@ -941,18 +933,6 @@ namespace AMDiS {
diam[i] = w; diam[i] = w;
} }
int Mesh::newDOFFct1(ElInfo* ei)
{
ei->getElement()->newDOFFct1(compressAdmin);
return 0;
}
int Mesh::newDOFFct2(ElInfo* ei)
{
ei->getElement()->newDOFFct2(compressAdmin);
return 0;
}
void Mesh::serialize(std::ostream &out) void Mesh::serialize(std::ostream &out)
{ {
serializedDOFs.clear(); serializedDOFs.clear();
......
...@@ -68,17 +68,6 @@ namespace AMDiS { ...@@ -68,17 +68,6 @@ namespace AMDiS {
/// Assignment operator /// Assignment operator
Mesh& operator=(const Mesh&); Mesh& operator=(const Mesh&);
/** \name static methods used while mesh traversal
* \{
*/
/// Used while dof compress
static int newDOFFct1(ElInfo* e);
/// Used while dof compress
static int newDOFFct2(ElInfo* e);
/** \} */
/** \name getting methods /** \name getting methods
* \{ * \{
*/ */
...@@ -765,9 +754,6 @@ namespace AMDiS { ...@@ -765,9 +754,6 @@ namespace AMDiS {
/// Needed during DOF compression (\ref DOFAdmin::compress). /// Needed during DOF compression (\ref DOFAdmin::compress).
std::vector<DegreeOfFreedom> newDOF; std::vector<DegreeOfFreedom> newDOF;
/// Needed during DOF compression (\ref DOFAdmin::compress).
static DOFAdmin *compressAdmin;
/// Used by check functions /// Used by check functions
static std::vector<DegreeOfFreedom> dof_used; static std::vector<DegreeOfFreedom> dof_used;
......
...@@ -564,16 +564,21 @@ namespace AMDiS { ...@@ -564,16 +564,21 @@ namespace AMDiS {
// here is reached already because of time adaption // here is reached already because of time adaption
allowFirstRefinement(); allowFirstRefinement();
TEST_EXIT_DBG(static_cast<unsigned int>(nComponents == marker