diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc index eef6a2cbe46bd4796cffdce266023d6c1fa88084..b52fca3d4d51325d8f530f53cbbb055414e0e474 100644 --- a/AMDiS/src/AdaptInstationary.cc +++ b/AMDiS/src/AdaptInstationary.cc @@ -205,7 +205,7 @@ namespace AMDiS { problemTime_->initTimestep(adaptInfo_); - /*#ifdef _OPENMP + #ifdef _OPENMP #pragma omp parallel sections { #pragma omp section @@ -214,11 +214,10 @@ namespace AMDiS { #pragma omp section oneTimestep(); } -#else - */ - // problemTime_->startDelayedTimestepCalculation(); +#else + problemTime_->startDelayedTimestepCalculation(); oneTimestep(); - //#endif +#endif problemTime_->closeTimestep(adaptInfo_); diff --git a/AMDiS/src/DataCollector.cc b/AMDiS/src/DataCollector.cc index f2b8ef39acb670be76697cd2158c4334515aadcf..67c460b96e2fe5944f75aa7e0928515ed5b64cb1 100644 --- a/AMDiS/src/DataCollector.cc +++ b/AMDiS/src/DataCollector.cc @@ -58,21 +58,17 @@ namespace AMDiS { void DataCollector::fillAllData() { - ::std::cout << "START1" << ::std::endl; if (!elementDataCollected_) { startCollectingElementData(); } - ::std::cout << "START2" << ::std::endl; if (!periodicDataCollected_) { startCollectingPeriodicData(); } - ::std::cout << "START3" << ::std::endl; if (!valueDataCollected_) { startCollectingValueData(); } - ::std::cout << "START4" << ::std::endl; } int DataCollector::startCollectingElementData() @@ -122,6 +118,10 @@ namespace AMDiS { interpPoints_.clear(); + basisFcts_ = const_cast<BasisFunction*>(feSpace_->getBasisFcts()); + nBasisFcts_ = basisFcts_->getNumber(); + localDOFs_ = GET_MEMORY(DegreeOfFreedom, basisFcts_->getNumber()); + TraverseStack stack; // Traverse elements to add value information and to mark @@ -131,10 +131,10 @@ namespace AMDiS { traverseFlag_ | Mesh::FILL_COORDS); while (elInfo) { if (!writeElem_ || writeElem_(elInfo)) - addValueData(elInfo); + addValueData(elInfo); elInfo = stack.traverseNext(elInfo); } - + // Remove all interpolation marks and, instead, set to each // interpolation point its continous index starting from 0. int i = 0; @@ -152,8 +152,9 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } + FREE_MEMORY(localDOFs_, DegreeOfFreedom, feSpace_->getBasisFcts()->getNumber()); valueDataCollected_ = true; - + return(0); } @@ -287,29 +288,29 @@ namespace AMDiS { { FUNCNAME("DataCollector::addValueData()"); - const BasisFunction *basisFcts = feSpace_->getBasisFcts(); - const DegreeOfFreedom *localDOFs = basisFcts->getLocalIndices(elInfo->getElement(), localAdmin_, NULL); - const int nBasisFcts = basisFcts->getNumber(); + basisFcts_->getLocalIndices(elInfo->getElement(), localAdmin_, localDOFs_); + WorldVector<double> vertexCoords; // First, traverse all DOFs at the vertices of the element, determine - // their coordinates and add them to the corresponding entry in dofCoords_. - + // their coordinates and add them to the corresponding entry in dofCoords_. for (int i = 0; i < mesh_->getGeo(VERTEX); i++) { - (*interpPointInd_)[localDOFs[i]] = -2; // mark as vertex + DegreeOfFreedom dofi = localDOFs_[i]; + + (*interpPointInd_)[dofi] = -2; // mark as vertex // get coords of this vertex - WorldVector<double> vertexCoords = elInfo->getCoord(i); + vertexCoords = elInfo->getCoord(i); // search for coords at this dof ::std::list<WorldVector<double> >::iterator it = - find((*dofCoords_)[localDOFs[i]].begin(), - (*dofCoords_)[localDOFs[i]].end(), + find((*dofCoords_)[dofi].begin(), + (*dofCoords_)[dofi].end(), vertexCoords); // coords not yet in list? - if (it == (*dofCoords_)[localDOFs[i]].end()) { + if (it == (*dofCoords_)[dofi].end()) { // add new coords to list - (*dofCoords_)[localDOFs[i]].push_back(vertexCoords); + (*dofCoords_)[dofi].push_back(vertexCoords); } } @@ -318,29 +319,29 @@ namespace AMDiS { // Then, traverse all interpolation DOFs of the element, determine // their coordinates and add them to the corresponding entry in // interpPointCoords_. + for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts_; i++) { + DegreeOfFreedom dofi = localDOFs_[i]; - for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts; i++) { - WorldVector<double> interpolCoords; - elInfo->coordToWorld(*basisFcts->getCoords(i), &interpolCoords); + elInfo->coordToWorld(*basisFcts_->getCoords(i), &vertexCoords); - if ((*interpPointInd_)[localDOFs[i]] == -1) { + if ((*interpPointInd_)[dofi] == -1) { // mark as interpolation point - (*interpPointInd_)[localDOFs[i]] = -3; + (*interpPointInd_)[dofi] = -3; // search for interpolation point coordinates, and insert them to the // dof-entry, if not contained in the list ::std::list<WorldVector<double> >::iterator it = - find((*interpPointCoords_)[localDOFs[i]].begin(), - (*interpPointCoords_)[localDOFs[i]].end(), - interpolCoords); + find((*interpPointCoords_)[dofi].begin(), + (*interpPointCoords_)[dofi].end(), + vertexCoords); - if (it == (*interpPointCoords_)[localDOFs[i]].end()) { - (*interpPointCoords_)[localDOFs[i]].push_back(interpolCoords); + if (it == (*interpPointCoords_)[dofi].end()) { + (*interpPointCoords_)[dofi].push_back(vertexCoords); nInterpPoints_++; } } } - + return(0); } @@ -348,15 +349,11 @@ namespace AMDiS { { FUNCNAME("DataCollector::addInterpData()"); - ::std::vector<int> elemInterpPoints; - elemInterpPoints.clear(); - - const BasisFunction *basisFcts = feSpace_->getBasisFcts(); - const DegreeOfFreedom *localDOFs = basisFcts->getLocalIndices(elInfo->getElement(), localAdmin_, NULL); - const int nBasisFcts = basisFcts->getNumber(); + basisFcts_->getLocalIndices(elInfo->getElement(), localAdmin_, localDOFs_); - for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts; i++) { - elemInterpPoints.push_back((*interpPointInd_)[localDOFs[i]]); + ::std::vector<int> elemInterpPoints(nBasisFcts_); + for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts_; i++) { + elemInterpPoints[i] = (*interpPointInd_)[localDOFs_[i]]; } interpPoints_.push_back(elemInterpPoints); diff --git a/AMDiS/src/DataCollector.h b/AMDiS/src/DataCollector.h index 2e5d168c8c4daf2e1b69f45a18d814922f9b2f81..0c91d07770c278bb855ec1f97694080704f1ba10 100644 --- a/AMDiS/src/DataCollector.h +++ b/AMDiS/src/DataCollector.h @@ -300,6 +300,21 @@ namespace AMDiS { * Pointer to a function which decides whether an element is considered. */ bool (*writeElem_)(ElInfo*); + + /** \brief + * Temporary variable used in functions addValueData() and addInterpData(). + */ + DegreeOfFreedom *localDOFs_; + + /** \brief + * Temporary variable used in functions addValueData() and addInterpData(). + */ + BasisFunction *basisFcts_; + + /** \brief + * Temporaru variable used in functions addValueData() and addInterpData(). + */ + int nBasisFcts_; }; } diff --git a/AMDiS/src/FileWriter.cc b/AMDiS/src/FileWriter.cc index 5804e188ae752f79af4fd5b71e559cd9a423324c..2831fa89770fa4e56784bc0febcd2e1dcec01482 100644 --- a/AMDiS/src/FileWriter.cc +++ b/AMDiS/src/FileWriter.cc @@ -197,19 +197,14 @@ namespace AMDiS { if (delayWriting_) { - ::std::cout << "REIN!" << ::std::endl; ::std::cout.flush(); - if (writeTecPlotFormat || writeAMDiSFormat || writePeriodicFormat) { ERROR_EXIT("Delay writing only supported for ParaView file format!\n"); } - ::std::cout << "DC=" << dataCollectors_.size()<< ::std::endl; for (int i = 0; i < static_cast<int>(dataCollectors_.size()); i++) { dataCollectors_[i]->fillAllData(); } - ::std::cout << "BIS HIERHIN!" << ::std::endl; ::std::cout.flush(); - writingIsDelayed_ = true; delayedFilename_ = fn; return;