From 45b07a0aa5de56556da908c2c9d49c396a27bcb8 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Tue, 26 Aug 2008 09:43:21 +0000 Subject: [PATCH] * Faster VTK file writing * Faster serialization of all objects --- AMDiS/src/AdaptInfo.cc | 12 ++--- AMDiS/src/AdaptInfo.h | 12 ++--- AMDiS/src/AdaptInstationary.cc | 18 +++---- AMDiS/src/DOFAdmin.cc | 6 ++- AMDiS/src/DataCollector.cc | 85 ++++++++++++++++++---------------- AMDiS/src/DataCollector.h | 35 ++++++++------ AMDiS/src/Element.cc | 50 ++++++++++---------- AMDiS/src/ElementData.cc | 12 ++--- AMDiS/src/ElementData.h | 10 ++-- AMDiS/src/MacroElement.cc | 17 +++---- AMDiS/src/Mesh.cc | 60 +++++++++++++----------- AMDiS/src/ProblemScal.cc | 20 ++++---- AMDiS/src/ProblemScal.h | 14 +++--- AMDiS/src/ProblemVec.h | 44 +++++++++--------- AMDiS/src/VtkWriter.cc | 70 ++++++++++++++-------------- AMDiS/src/VtkWriter.h | 14 +++--- 16 files changed, 249 insertions(+), 230 deletions(-) diff --git a/AMDiS/src/AdaptInfo.cc b/AMDiS/src/AdaptInfo.cc index e0f7cfd0..66a4aa98 100644 --- a/AMDiS/src/AdaptInfo.cc +++ b/AMDiS/src/AdaptInfo.cc @@ -11,13 +11,13 @@ namespace AMDiS { char number[5]; for (int i = oldSize; i < newSize; i++) { sprintf(number, "[%d]", i); - scalContents[i] = new ScalContent(name + ::std::string(number)); + scalContents[i] = new ScalContent(name + std::string(number)); } } } - void AdaptInfo::serialize(::std::ostream& out) { - out << name << ::std::endl; + void AdaptInfo::serialize(std::ostream& out) { + out << name << "\n"; out.write(reinterpret_cast<const char*>(&maxSpaceIteration), sizeof(int)); out.write(reinterpret_cast<const char*>(&spaceIteration), sizeof(int)); out.write(reinterpret_cast<const char*>(×tepIteration), sizeof(int)); @@ -63,9 +63,9 @@ namespace AMDiS { } } - void AdaptInfo::deserialize(::std::istream& in) { + void AdaptInfo::deserialize(std::istream& in) { in >> name; - in.get(); // because of ::std::endl in serialization + in.get(); // because of std::endl in serialization in.read(reinterpret_cast<char*>(&maxSpaceIteration), sizeof(int)); in.read(reinterpret_cast<char*>(&spaceIteration), sizeof(int)); @@ -91,7 +91,7 @@ namespace AMDiS { // if (!scalContents[i]) { char number[5]; sprintf(number, "[%d]", i); - scalContents[i] = new ScalContent(name + ::std::string(number)); + scalContents[i] = new ScalContent(name + std::string(number)); // } in.read(reinterpret_cast<char*>(&(scalContents[i]->est_sum)), sizeof(double)); diff --git a/AMDiS/src/AdaptInfo.h b/AMDiS/src/AdaptInfo.h index 0bf7beca..018a392c 100644 --- a/AMDiS/src/AdaptInfo.h +++ b/AMDiS/src/AdaptInfo.h @@ -52,7 +52,7 @@ namespace AMDiS { /** \brief * Constructor. */ - ScalContent(::std::string prefix) + ScalContent(std::string prefix) : est_sum(0.0), est_t_sum(0.0), est_max(0.0), @@ -150,7 +150,7 @@ namespace AMDiS { /** \brief * Constructor. */ - AdaptInfo(::std::string name_, int size = 1) + AdaptInfo(std::string name_, int size = 1) : name(name_), spaceIteration(-1), maxSpaceIteration(-1), @@ -189,7 +189,7 @@ namespace AMDiS { char number[5]; for (int i = 0; i < size; i++) { sprintf(number, "[%d]", i); - scalContents[i] = new ScalContent(name + ::std::string(number)); + scalContents[i] = new ScalContent(name + std::string(number)); } } }; @@ -713,15 +713,15 @@ namespace AMDiS { } // ===== Serialiazable implementation ===== - void serialize(::std::ostream& out); + void serialize(std::ostream& out); - void deserialize(::std::istream& in); + void deserialize(std::istream& in); protected: /** \brief * Name. */ - ::std::string name; + std::string name; /** \brief * Current space iteration diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc index 23859e08..b989a83f 100644 --- a/AMDiS/src/AdaptInstationary.cc +++ b/AMDiS/src/AdaptInstationary.cc @@ -30,7 +30,7 @@ namespace AMDiS { } // Check if the problem should be deserialized because of the -rs parameter. - ::std::string serializationFilename = ""; + std::string serializationFilename = ""; GET_PARAMETER(0, "argv->rs", &serializationFilename); if (serializationFilename.compare("")) { @@ -38,7 +38,7 @@ namespace AMDiS { // serialization file mentioned in the used init file. MSG("Deserialization from file: %s\n", queueSerializationFilename_.c_str()); - ::std::ifstream in(queueSerializationFilename_.c_str()); + std::ifstream in(queueSerializationFilename_.c_str()); deserialize(in); in.close(); @@ -54,14 +54,14 @@ namespace AMDiS { &readSerializationWithAdaptInfo); if (readSerialization && readSerializationWithAdaptInfo) { - ::std::string serializationFilename = ""; + std::string serializationFilename = ""; GET_PARAMETER(0, (*problemStat).getName() + "->input->serialization filename", &serializationFilename); TEST_EXIT(serializationFilename != "")("no serialization file\n"); MSG("Deserialization with AdaptInfo from file: %s\n", serializationFilename.c_str()); - ::std::ifstream in(serializationFilename.c_str()); + std::ifstream in(serializationFilename.c_str()); deserialize(in); in.close(); } @@ -243,7 +243,7 @@ namespace AMDiS { return errorCode; } - void AdaptInstationary::initialize(const ::std::string& aName) + void AdaptInstationary::initialize(const std::string& aName) { FUNCNAME("AdaptInstationary::initialize()"); @@ -264,7 +264,7 @@ namespace AMDiS { return; } - void AdaptInstationary::serialize(::std::ostream &out) + void AdaptInstationary::serialize(std::ostream &out) { FUNCNAME("AdaptInstationary::serialize()"); @@ -275,7 +275,7 @@ namespace AMDiS { } } - void AdaptInstationary::deserialize(::std::istream &in) + void AdaptInstationary::deserialize(std::istream &in) { FUNCNAME("AdaptInstationary::deserialize()"); @@ -305,7 +305,7 @@ namespace AMDiS { } // Calculate the avarage of the last iterations. - ::std::queue<int> tmpQueue = lastIterationsDuration_; + std::queue<int> tmpQueue = lastIterationsDuration_; int avrgLastIterations = 0; while (!tmpQueue.empty()) { avrgLastIterations += tmpQueue.front(); @@ -315,7 +315,7 @@ namespace AMDiS { // Check if there is enough time for a further iteration. if (initialTimestamp_ + queueRuntime_ - currentTimestamp < avrgLastIterations * 2) { - ::std::ofstream out(queueSerializationFilename_.c_str()); + std::ofstream out(queueSerializationFilename_.c_str()); serialize(out); out.close(); diff --git a/AMDiS/src/DOFAdmin.cc b/AMDiS/src/DOFAdmin.cc index af82150f..9b53871b 100755 --- a/AMDiS/src/DOFAdmin.cc +++ b/AMDiS/src/DOFAdmin.cc @@ -26,7 +26,9 @@ namespace AMDiS { : mesh(m), nrDOF(mesh->getDim(), NO_INIT), nr0DOF(mesh->getDim(), NO_INIT) - { init(); } + { + init(); + } DOFAdmin::DOFAdmin(Mesh* m,std::string aName) : name(aName), @@ -317,7 +319,7 @@ namespace AMDiS { void DOFAdmin::serialize(std::ostream &out) { // write name - out << name << std::endl; + out << name << "\n"; // write dofFree int s = static_cast<int>(dofFree.size()); diff --git a/AMDiS/src/DataCollector.cc b/AMDiS/src/DataCollector.cc index eb4851b4..2d642de2 100644 --- a/AMDiS/src/DataCollector.cc +++ b/AMDiS/src/DataCollector.cc @@ -25,10 +25,10 @@ namespace AMDiS { localAdmin_ = const_cast<DOFAdmin*>(feSpace->getAdmin()); // === create vertex info vector === - vertexInfos_ = NEW DOFVector< ::std::list<VertexInfo> >(feSpace, "vertex infos"); + vertexInfos_ = NEW DOFVector< std::list<VertexInfo> >(feSpace, "vertex infos"); interpPointInd_ = NEW DOFVector<int>(feSpace, "interpolation point indices"); - interpPointCoords_ = NEW DOFVector< ::std::list<WorldVector<double> > >(feSpace, "interpolation point coordinates"); - dofCoords_ = NEW DOFVector< ::std::list<WorldVector<double> > >(feSpace, "dof coords"); + interpPointCoords_ = NEW DOFVector< std::list<WorldVector<double> > >(feSpace, "interpolation point coordinates"); + dofCoords_ = NEW DOFVector< std::list<WorldVector<double> > >(feSpace, "dof coords"); dim_ = mesh_->getDim(); @@ -46,7 +46,9 @@ namespace AMDiS { elementDataCollected_ = false; valueDataCollected_ = false; periodicDataCollected_ = false; - } + + vertexCoords = NEW WorldVector<double>; + } DataCollector::~DataCollector() { @@ -54,6 +56,7 @@ namespace AMDiS { DELETE interpPointInd_; DELETE interpPointCoords_; DELETE dofCoords_; + DELETE vertexCoords; } void DataCollector::fillAllData() @@ -120,7 +123,7 @@ namespace AMDiS { basisFcts_ = const_cast<BasisFunction*>(feSpace_->getBasisFcts()); nBasisFcts_ = basisFcts_->getNumber(); - localDOFs_ = GET_MEMORY(DegreeOfFreedom, basisFcts_->getNumber()); + localDOFs_ = GET_MEMORY(DegreeOfFreedom, nBasisFcts_); TraverseStack stack; @@ -134,25 +137,29 @@ namespace AMDiS { 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; - for (intPointIt.reset(); !intPointIt.end(); ++intPointIt) { - if (*intPointIt == -3) { - *intPointIt = i++; - } - } - // Traverse elements to create interpolation values. - elInfo = stack.traverseFirst(mesh_, level_, traverseFlag_ | Mesh::FILL_COORDS); - while (elInfo) { - if (!writeElem_ || writeElem_(elInfo)) - addInterpData(elInfo); - elInfo = stack.traverseNext(elInfo); + // If there are interpolation points, add them to the corresponding + // data array. + if (nInterpPoints_ > 0) { + // Remove all interpolation marks and, instead, set to each + // interpolation point its continous index starting from 0. + int i = 0; + for (intPointIt.reset(); !intPointIt.end(); ++intPointIt) { + if (*intPointIt == -3) { + *intPointIt = i++; + } + } + + // Traverse elements to create interpolation values. + elInfo = stack.traverseFirst(mesh_, level_, traverseFlag_ | Mesh::FILL_COORDS); + while (elInfo) { + if (!writeElem_ || writeElem_(elInfo)) + addInterpData(elInfo); + elInfo = stack.traverseNext(elInfo); + } } - FREE_MEMORY(localDOFs_, DegreeOfFreedom, feSpace_->getBasisFcts()->getNumber()); + FREE_MEMORY(localDOFs_, DegreeOfFreedom, nBasisFcts_); valueDataCollected_ = true; return(0); @@ -245,7 +252,7 @@ namespace AMDiS { vertexDOF = dof[i][nPreDofs_]; // search for coords at this dof - ::std::list<VertexInfo>::iterator it = + std::list<VertexInfo>::iterator it = find((*vertexInfos_)[vertexDOF].begin(), (*vertexInfos_)[vertexDOF].end(), vertexCoords); @@ -289,7 +296,7 @@ namespace AMDiS { FUNCNAME("DataCollector::addValueData()"); basisFcts_->getLocalIndices(elInfo->getElement(), localAdmin_, localDOFs_); - WorldVector<double> vertexCoords; + // 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_. @@ -299,18 +306,18 @@ namespace AMDiS { (*interpPointInd_)[dofi] = -2; // mark as vertex // get coords of this vertex - vertexCoords = elInfo->getCoord(i); + *vertexCoords = elInfo->getCoord(i); // search for coords at this dof - ::std::list<WorldVector<double> >::iterator it = + std::list<WorldVector<double> >::iterator it = find((*dofCoords_)[dofi].begin(), (*dofCoords_)[dofi].end(), - vertexCoords); + *vertexCoords); // coords not yet in list? if (it == (*dofCoords_)[dofi].end()) { // add new coords to list - (*dofCoords_)[dofi].push_back(vertexCoords); + (*dofCoords_)[dofi].push_back(*vertexCoords); } } @@ -322,7 +329,7 @@ namespace AMDiS { for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts_; i++) { DegreeOfFreedom dofi = localDOFs_[i]; - elInfo->coordToWorld(*basisFcts_->getCoords(i), &vertexCoords); + elInfo->coordToWorld(*basisFcts_->getCoords(i), vertexCoords); if ((*interpPointInd_)[dofi] == -1) { // mark as interpolation point @@ -330,13 +337,13 @@ namespace AMDiS { // search for interpolation point coordinates, and insert them to the // dof-entry, if not contained in the list - ::std::list<WorldVector<double> >::iterator it = + std::list<WorldVector<double> >::iterator it = find((*interpPointCoords_)[dofi].begin(), (*interpPointCoords_)[dofi].end(), - vertexCoords); + *vertexCoords); if (it == (*interpPointCoords_)[dofi].end()) { - (*interpPointCoords_)[dofi].push_back(vertexCoords); + (*interpPointCoords_)[dofi].push_back(*vertexCoords); nInterpPoints_++; } } @@ -355,7 +362,7 @@ namespace AMDiS { for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts_; i++) { elemInterpPoints.push_back((*interpPointInd_)[localDOFs_[i]]); } - + interpPoints_.push_back(elemInterpPoints); return(0); @@ -370,7 +377,7 @@ namespace AMDiS { getElementData(PERIODIC)); if (ldp) { - ::std::list<LeafDataPeriodic::PeriodicInfo>::iterator it; + std::list<LeafDataPeriodic::PeriodicInfo>::iterator it; for (it = dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList().begin(); it != dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList().end(); @@ -422,7 +429,7 @@ namespace AMDiS { return(0); } - ::std::list<ElementInfo>* DataCollector::getElementInfos() + std::list<ElementInfo>* DataCollector::getElementInfos() { if (!elementDataCollected_) { startCollectingElementData(); @@ -431,7 +438,7 @@ namespace AMDiS { return &elements_; } - DOFVector< ::std::list<VertexInfo> >* DataCollector::getVertexInfos() + DOFVector< std::list<VertexInfo> >* DataCollector::getVertexInfos() { if (!elementDataCollected_) { startCollectingElementData(); @@ -440,7 +447,7 @@ namespace AMDiS { return vertexInfos_; } - ::std::list<PeriodicInfo>* DataCollector::getPeriodicInfos() + std::list<PeriodicInfo>* DataCollector::getPeriodicInfos() { if (!periodicDataCollected_) { startCollectingPeriodicData(); @@ -504,7 +511,7 @@ namespace AMDiS { return values_; } - DOFVector< ::std::list<WorldVector<double> > >* DataCollector::getDofCoords() + DOFVector< std::list<WorldVector<double> > >* DataCollector::getDofCoords() { if (!valueDataCollected_) { startCollectingValueData(); @@ -522,7 +529,7 @@ namespace AMDiS { return interpPointInd_; } - DOFVector< ::std::list<WorldVector<double> > >* DataCollector::getInterpPointCoords() + DOFVector< std::list<WorldVector<double> > >* DataCollector::getInterpPointCoords() { if (!valueDataCollected_) { startCollectingValueData(); @@ -531,7 +538,7 @@ namespace AMDiS { return interpPointCoords_; } - ::std::vector< ::std::vector<int> >* DataCollector::getInterpPoints() + std::vector< std::vector<int> >* DataCollector::getInterpPoints() { if (!valueDataCollected_) { startCollectingValueData(); diff --git a/AMDiS/src/DataCollector.h b/AMDiS/src/DataCollector.h index 86d6cf5f..88e44be2 100644 --- a/AMDiS/src/DataCollector.h +++ b/AMDiS/src/DataCollector.h @@ -69,12 +69,12 @@ namespace AMDiS { /** \brief * Returns list with element information. */ - ::std::list<ElementInfo>* getElementInfos(); + std::list<ElementInfo>* getElementInfos(); /** \brief * Returns vector with vertex information. */ - DOFVector< ::std::list<VertexInfo> >* getVertexInfos(); + DOFVector< std::list<VertexInfo> >* getVertexInfos(); /** \brief * Returns the finite element space of the problem. @@ -89,7 +89,7 @@ namespace AMDiS { /** \brief * Returns vector with information about dof coordinates. */ - DOFVector< ::std::list<WorldVector<double> > >* getDofCoords(); + DOFVector< std::list<WorldVector<double> > >* getDofCoords(); /** \brief * Returns vector with information about interpolation @@ -100,17 +100,17 @@ namespace AMDiS { /** \brief * */ - DOFVector< ::std::list<WorldVector<double> > >* getInterpPointCoords(); + DOFVector< std::list<WorldVector<double> > >* getInterpPointCoords(); /** \brief * Returns list of interpolation point information. */ - ::std::vector< ::std::vector<int> >* getInterpPoints(); + std::vector< std::vector<int> >* getInterpPoints(); /** \brief * Returns list of information about periodics. */ - ::std::list<PeriodicInfo>* getPeriodicInfos(); + std::list<PeriodicInfo>* getPeriodicInfos(); /** \brief * Returns the number of vertices. @@ -241,7 +241,7 @@ namespace AMDiS { /** \brief * Maps internal element indices to global output indices. */ - ::std::map<int, int> outputIndices_; + std::map<int, int> outputIndices_; /** \brief * Global interpolation point indexing @@ -251,39 +251,39 @@ namespace AMDiS { /** \brief * Stores for each simplex the interpolation points. */ - ::std::vector< ::std::vector<int> > interpPoints_; + std::vector< std::vector<int> > interpPoints_; /** \brief * Stores for each DOF a list of its coordinates. If there are now periodic * boundaries than there is also only one coordinate per DOF. */ - DOFVector< ::std::list<WorldVector<double> > > *interpPointCoords_; + DOFVector< std::list<WorldVector<double> > > *interpPointCoords_; /** \brief * list of coords for each dof */ - DOFVector< ::std::list<WorldVector<double> > > *dofCoords_; + DOFVector< std::list<WorldVector<double> > > *dofCoords_; /** \brief * List that stores an ElementInfo for each element. */ - ::std::list<ElementInfo> elements_; + std::list<ElementInfo> elements_; /** \brief * List stat stores information about all periodics. */ - ::std::list<PeriodicInfo> periodicInfos_; + std::list<PeriodicInfo> periodicInfos_; /** \brief * Stores a list of vertex infos for each dof. */ - DOFVector< ::std::list<VertexInfo> > *vertexInfos_; + DOFVector< std::list<VertexInfo> > *vertexInfos_; /** \brief * periodicConnections[i][j] stores whether the connection at side j of * the element with output index i has already been written. */ - ::std::vector<DimVec<bool> > periodicConnections_; + std::vector<DimVec<bool> > periodicConnections_; /** \brief * Stores if element data was collected before. @@ -316,9 +316,14 @@ namespace AMDiS { BasisFunction *basisFcts_; /** \brief - * Temporaru variable used in functions addValueData() and addInterpData(). + * Temporary variable used in functions addValueData() and addInterpData(). */ int nBasisFcts_; + + /** \brief + * Temporary variable used in function \ref addValueData. + */ + WorldVector<double> *vertexCoords; }; } diff --git a/AMDiS/src/Element.cc b/AMDiS/src/Element.cc index e27ebc6b..94f62732 100644 --- a/AMDiS/src/Element.cc +++ b/AMDiS/src/Element.cc @@ -252,39 +252,37 @@ namespace AMDiS { }; } - void Element::serialize(::std::ostream &out) + void Element::serialize(std::ostream &out) { // write children if(child[0]) { - out << child[0]->getTypeName() << ::std::endl; + out << child[0]->getTypeName() << "\n"; child[0]->serialize(out); child[1]->serialize(out); } else { - out << "NULL" << ::std::endl; + out << "NULL\n"; } // write dofs int dim = mesh->getDim(); int nodes = mesh->getNumberOfNodes(); + int j = 0; out.write(reinterpret_cast<const char*>(&nodes), sizeof(int)); - - int i, j = 0, ndof, pos; - - for(pos = 0; pos <= dim; pos++) { + + for (int pos = 0; pos <= dim; pos++) { GeoIndex position = INDEX_OF_DIM(pos ,dim); + int ndof = 0; - ndof = 0; - - for (i = 0; i < mesh->getNumberOfDOFAdmin(); i++) { + for (int i = 0; i < mesh->getNumberOfDOFAdmin(); i++) { const DOFAdmin *localAdmin = &mesh->getDOFAdmin(i); TEST_EXIT_DBG(localAdmin)("no admin[%d]\n", i); ndof += localAdmin->getNumberOfDOFs(position); } - if(ndof > 0) { - for(i = 0; i < mesh->getGeo(position); i++) { - if(dof[j] != NULL) { - if(Mesh::serializedDOFs[dof[j][0]] == NULL) { + if (ndof > 0) { + for (int i = 0; i < mesh->getGeo(position); i++) { + if (dof[j] != NULL) { + if (Mesh::serializedDOFs[dof[j][0]] == NULL) { Mesh::serializedDOFs[dof[j][0]] = dof[j]; out.write(reinterpret_cast<const char*>(&ndof), sizeof(int)); out.write(reinterpret_cast<const char*>(dof[j]), @@ -310,40 +308,40 @@ namespace AMDiS { out.write(reinterpret_cast<const char*>(&mark), sizeof(signed char)); // write newCoord - if(newCoord) { - out << "WorldVector" << ::std::endl; + if (newCoord) { + out << "WorldVector\n"; newCoord->serialize(out); } else { - out << "NULL" << ::std::endl; + out << "NULL\n"; } // write element data - if(elementData) { - out << elementData->getTypeName() << ::std::endl; + if (elementData) { + out << elementData->getTypeName() << "\n"; elementData->serialize(out); } else { - out << "NULL" << ::std::endl; + out << "NULL\n"; } } - void Element::deserialize(::std::istream &in) + void Element::deserialize(std::istream &in) { - ::std::string typeName; + std::string typeName; // read children in >> typeName; in.get(); - if(typeName != "NULL") { - if(typeName == "Line") { + if (typeName != "NULL") { + if (typeName == "Line") { child[0] = new Line(NULL); child[1] = new Line(NULL); }; - if(typeName == "Triangle") { + if (typeName == "Triangle") { child[0] = new Triangle(NULL); child[1] = new Triangle(NULL); }; - if(typeName == "Tetrahedron") { + if (typeName == "Tetrahedron") { child[0] = new Tetrahedron(NULL); child[1] = new Tetrahedron(NULL); }; diff --git a/AMDiS/src/ElementData.cc b/AMDiS/src/ElementData.cc index 05d43c34..d48d4137 100644 --- a/AMDiS/src/ElementData.cc +++ b/AMDiS/src/ElementData.cc @@ -2,21 +2,21 @@ namespace AMDiS { - void ElementData::serialize(::std::ostream& out) { - ::std::string decoratedType; + void ElementData::serialize(std::ostream& out) { + std::string decoratedType; if (decorated_) { decoratedType = decorated_->getTypeName(); - out << decoratedType << ::std::endl; + out << decoratedType << "\n"; decorated_->serialize(out); } else { - out << "NULL" << ::std::endl; + out << "NULL\n"; } } - void ElementData::deserialize(::std::istream& in) { + void ElementData::deserialize(std::istream& in) { TEST_EXIT(decorated_ == NULL) ("there are already decorated element data\n"); - ::std::string decoratedType; + std::string decoratedType; in >> decoratedType; in.get(); if (decoratedType != "NULL") { diff --git a/AMDiS/src/ElementData.h b/AMDiS/src/ElementData.h index e1423de5..0761aa92 100644 --- a/AMDiS/src/ElementData.h +++ b/AMDiS/src/ElementData.h @@ -121,21 +121,21 @@ namespace AMDiS { /** \brief * Implements Serializable::serialize(). */ - virtual void serialize(::std::ostream& out); + virtual void serialize(std::ostream& out); /** \brief * Implements Serializable::deserialize(). */ - virtual void deserialize(::std::istream& in); + virtual void deserialize(std::istream& in); /** \brief * Returns first element data in the chain which is of the spcified type. */ inline ElementData *getElementData(int typeID) { - if(this->isOfType(typeID)) { + if (this->isOfType(typeID)) { return this; } else { - if(decorated_) { + if (decorated_) { return decorated_->getElementData(typeID); } } @@ -143,7 +143,7 @@ namespace AMDiS { }; inline ElementData *getDecorated(int typeID) { - if(decorated_) { + if (decorated_) { return decorated_->getElementData(typeID); } return NULL; diff --git a/AMDiS/src/MacroElement.cc b/AMDiS/src/MacroElement.cc index 8378759b..a8b32193 100644 --- a/AMDiS/src/MacroElement.cc +++ b/AMDiS/src/MacroElement.cc @@ -26,19 +26,20 @@ namespace AMDiS { MacroElement::~MacroElement() { - if(element) DELETE element; + if (element) + DELETE element; }; void MacroElement::serialize(::std::ostream &out) { // write element-tree - out << element->getTypeName() << ::std::endl; + out << element->getTypeName() << "\n"; element->serialize(out); // write coords - int i, size = coord.getSize(); + int size = coord.getSize(); out.write(reinterpret_cast<const char*>(&size), sizeof(int)); - for(i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { coord[i].serialize(out); } @@ -48,7 +49,7 @@ namespace AMDiS { // write projection size = projection.getSize(); out.write(reinterpret_cast<const char*>(&size), sizeof(int)); - for(i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { int id = projection[i] ? projection[i]->getID() : -1; out.write(reinterpret_cast<const char*>(&id), sizeof(int)); } @@ -56,7 +57,7 @@ namespace AMDiS { // write neighbour size = neighbour.getSize(); out.write(reinterpret_cast<const char*>(&size), sizeof(int)); - for(i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { int index = neighbour[i] ? neighbour[i]->getIndex() : -1; out.write(reinterpret_cast<const char*>(&index), sizeof(int)); } @@ -71,10 +72,10 @@ namespace AMDiS { out.write(reinterpret_cast<const char*>(&elType), sizeof(unsigned char)); } - void MacroElement::deserialize(::std::istream &in) + void MacroElement::deserialize(std::istream &in) { // read element-tree - ::std::string typeName; + std::string typeName; in >> typeName; in.get(); diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index 9d605424..475b13d2 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -62,13 +62,13 @@ namespace AMDiS { // const Flag Mesh::USE_PARAMETRIC = 0X8000L ; // used in mg methods - // ::std::list<Mesh*> Mesh::meshes; + // std::list<Mesh*> Mesh::meshes; DOFAdmin* Mesh::compressAdmin = NULL; Mesh* Mesh::traversePtr = NULL; int Mesh::iadmin = 0; - ::std::vector<DegreeOfFreedom> Mesh::dof_used; + std::vector<DegreeOfFreedom> Mesh::dof_used; const int Mesh::MAX_DOF=100; - ::std::map<DegreeOfFreedom, DegreeOfFreedom*> Mesh::serializedDOFs; + std::map<DegreeOfFreedom, DegreeOfFreedom*> Mesh::serializedDOFs; struct delmem { DegreeOfFreedom* ptr; @@ -76,7 +76,7 @@ namespace AMDiS { }; - Mesh::Mesh(const ::std::string& aName, int dimension) + Mesh::Mesh(const std::string& aName, int dimension) : name(aName), dim(dimension), nVertices(0), @@ -135,7 +135,7 @@ namespace AMDiS { { FUNCNAME("Mesh::traverse()"); - ::std::deque<MacroElement*>::iterator mel; + std::deque<MacroElement*>::iterator mel; ElInfoStack elInfoStack(this); ElInfo* elinfo = elInfoStack.getNextElement(); Traverse tinfo(this, flag, level, el_fct); @@ -166,12 +166,12 @@ namespace AMDiS { FUNCNAME("Mesh::addDOFAdmin()"); int i, j, d, n; - ::std::vector<DOFAdmin*>::iterator dai; + std::vector<DOFAdmin*>::iterator dai; localAdmin->setMesh(this); n = admin.size(); - dai=::std::find(admin.begin(),admin.end(),localAdmin); + dai=std::find(admin.begin(),admin.end(),localAdmin); if (dai!= admin.end()) { ERROR("admin %s is already associated to mesh %s\n", localAdmin->getName().c_str(), this->getName().c_str()); @@ -195,8 +195,8 @@ namespace AMDiS { static bool **parentNeedsDOF[4] = {NULL, pnd_1d, pnd_2d, pnd_3d}; - ::std::list<struct delmem> delList; - ::std::map< ::std::set<DegreeOfFreedom>, DegreeOfFreedom*> dofPtrMap; + std::list<struct delmem> delList; + std::map< std::set<DegreeOfFreedom>, DegreeOfFreedom*> dofPtrMap; const DOFAdmin *vertexAdmin = getVertexAdmin(); int vertexAdminPreDOFs = vertexAdmin->getNumberOfPreDOFs(VERTEX); @@ -267,7 +267,7 @@ namespace AMDiS { // for all vertices/edges/... for(i = 0; i < getGeo(geoIndex); i++, index++) { - ::std::set<DegreeOfFreedom> dofSet; + std::set<DegreeOfFreedom> dofSet; for(j = 0; j < d+1; j++) { dofSet.insert(dof[element->getVertexOfPosition(geoIndex, i, j)][vertexAdminPreDOFs]); } @@ -307,7 +307,7 @@ namespace AMDiS { // now free the old dof memory: - ::std::list<struct delmem>::iterator it=delList.begin(); + std::list<struct delmem>::iterator it=delList.begin(); while(it!=delList.end()) { FREE_MEMORY((*it).ptr, DegreeOfFreedom, (*it).len); @@ -462,7 +462,7 @@ namespace AMDiS { } - const DOFAdmin *Mesh::createDOFAdmin(const ::std::string& lname,DimVec<int> lnDOF) + const DOFAdmin *Mesh::createDOFAdmin(const std::string& lname,DimVec<int> lnDOF) { FUNCNAME("Mesh::createDOFAdmin"); @@ -483,7 +483,7 @@ namespace AMDiS { - // int Mesh::macroType(const ::std::string& filename, const ::std::string& type) + // int Mesh::macroType(const std::string& filename, const std::string& type) // { // const char *fn, *t; @@ -833,9 +833,15 @@ namespace AMDiS { } - void Mesh::setDiameter(const WorldVector<double>& w) { diam = w; } + void Mesh::setDiameter(const WorldVector<double>& w) + { + diam = w; + } - void Mesh::setDiameter(int i, double w) { diam[i] = w; } + void Mesh::setDiameter(int i, double w) + { + diam[i] = w; + } int Mesh::newDOFFct1(ElInfo* ei) { @@ -848,12 +854,12 @@ namespace AMDiS { return 0; } - void Mesh::serialize(::std::ostream &out) + void Mesh::serialize(std::ostream &out) { serializedDOFs.clear(); // write name - out << name << ::std::endl; + out << name << "\n"; // write dim out.write(reinterpret_cast<const char*>(&dim), sizeof(int)); @@ -917,7 +923,7 @@ namespace AMDiS { serializedDOFs.clear(); } - void Mesh::deserialize(::std::istream &in) + void Mesh::deserialize(std::istream &in) { serializedDOFs.clear(); @@ -984,7 +990,7 @@ namespace AMDiS { // read macroElements in.read(reinterpret_cast<char*>(&size), sizeof(int)); - ::std::vector< ::std::vector<int> > neighbourIndices(size); + std::vector< std::vector<int> > neighbourIndices(size); for (i = 0; i < static_cast<int>(macroElements.size()); i++) { if (macroElements[i]) { @@ -1030,9 +1036,9 @@ namespace AMDiS { void Mesh::initialize() { - ::std::string macroFilename(""); - ::std::string valueFilename(""); - ::std::string periodicFile(""); + std::string macroFilename(""); + std::string valueFilename(""); + std::string periodicFile(""); int check = 1; GET_PARAMETER(0, name + "->macro file name", ¯oFilename); @@ -1058,8 +1064,8 @@ namespace AMDiS { } bool Mesh::associated(DegreeOfFreedom dof1, DegreeOfFreedom dof2) { - ::std::map<BoundaryType, VertexVector*>::iterator it; - ::std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end(); + std::map<BoundaryType, VertexVector*>::iterator it; + std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end(); for (it = periodicAssociations.begin(); it != end; ++it) { if ((*(it->second))[dof1] == dof2) return true; @@ -1068,9 +1074,9 @@ namespace AMDiS { } bool Mesh::indirectlyAssociated(DegreeOfFreedom dof1, DegreeOfFreedom dof2) { - ::std::vector<DegreeOfFreedom> associatedToDOF1; - ::std::map<BoundaryType, VertexVector*>::iterator it; - ::std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end(); + std::vector<DegreeOfFreedom> associatedToDOF1; + std::map<BoundaryType, VertexVector*>::iterator it; + std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end(); DegreeOfFreedom dof, assDOF; associatedToDOF1.push_back(dof1); diff --git a/AMDiS/src/ProblemScal.cc b/AMDiS/src/ProblemScal.cc index a0746ed8..d632c7ad 100644 --- a/AMDiS/src/ProblemScal.cc +++ b/AMDiS/src/ProblemScal.cc @@ -140,7 +140,7 @@ namespace AMDiS { TEST_EXIT(Parameters::initialized())("parameters not initialized\n"); // === create problems mesh === - ::std::string meshName(""); + std::string meshName(""); GET_PARAMETER(0, name_ + "->info", "%d", &info_); GET_PARAMETER(0, name_ + "->mesh", &meshName); @@ -363,7 +363,7 @@ namespace AMDiS { // before timeout of the runqueue. int readSerialization = 0; - ::std::string serializationFilename = ""; + std::string serializationFilename = ""; GET_PARAMETER(0, "argv->rs", &serializationFilename); // If the parameter -rs is set, we do nothing here, because the problem will be @@ -377,7 +377,7 @@ namespace AMDiS { TEST_EXIT(serializationFilename != "")("no serialization file\n"); MSG("Deserialization from file: %s\n", serializationFilename.c_str()); - ::std::ifstream in(serializationFilename.c_str()); + std::ifstream in(serializationFilename.c_str()); deserialize(in); in.close(); } else { @@ -386,7 +386,7 @@ namespace AMDiS { } // === read value file and use it for the mesh values === - ::std::string valueFilename(""); + std::string valueFilename(""); GET_PARAMETER(0, mesh_->getName() + "->value file name", &valueFilename); if (valueFilename.length()) { ValueReader::readValue(valueFilename.c_str(), @@ -443,7 +443,7 @@ namespace AMDiS { void ProblemScal::createSolver() { // === create solver === - ::std::string solverType("no"); + std::string solverType("no"); GET_PARAMETER(0, name_ + "->solver", &solverType); OEMSolverCreator<DOFVector<double> > *solverCreator = dynamic_cast<OEMSolverCreator<DOFVector<double> >*>( @@ -454,7 +454,7 @@ namespace AMDiS { solver_->initParameters(); // === create preconditioners === - ::std::string preconType("no"); + std::string preconType("no"); Preconditioner<DOFVector<double> > *precon; GET_PARAMETER(0, name_ + "->solver->left precon", &preconType); CreatorInterface<PreconditionerScal> *preconCreator = @@ -502,7 +502,7 @@ namespace AMDiS { //estimator = NEW ResidualEstimator(name + "->estimator"); // === create estimator === - ::std::string estimatorType("no"); + std::string estimatorType("no"); GET_PARAMETER(0, name_ + "->estimator", &estimatorType); EstimatorCreator *estimatorCreator = dynamic_cast<EstimatorCreator*>( @@ -644,7 +644,7 @@ namespace AMDiS { return 0; } - void ProblemScal::writeResidualMesh(AdaptInfo *adaptInfo, const ::std::string name) + void ProblemScal::writeResidualMesh(AdaptInfo *adaptInfo, const std::string name) { FUNCNAME("ProblemVec::writeResidualMesh()"); @@ -671,7 +671,7 @@ namespace AMDiS { fw.writeFiles(adaptInfo, true); } - void ProblemScal::serialize(::std::ostream &out) + void ProblemScal::serialize(std::ostream &out) { FUNCNAME("ProblemScal::serialize()"); @@ -679,7 +679,7 @@ namespace AMDiS { solution_->serialize(out); } - void ProblemScal::deserialize(::std::istream &in) + void ProblemScal::deserialize(std::istream &in) { FUNCNAME("ProblemScal::deserialize()"); diff --git a/AMDiS/src/ProblemScal.h b/AMDiS/src/ProblemScal.h index 3d42a2bd..e9402da8 100644 --- a/AMDiS/src/ProblemScal.h +++ b/AMDiS/src/ProblemScal.h @@ -332,7 +332,7 @@ namespace AMDiS { /** \brief * Returns \ref name_. */ - virtual inline const ::std::string& getName() { + virtual inline const std::string& getName() { return name_; }; @@ -414,21 +414,21 @@ namespace AMDiS { /** \} */ - void writeResidualMesh(AdaptInfo *adaptInfo, const ::std::string name); + void writeResidualMesh(AdaptInfo *adaptInfo, const std::string name); // ===== Serializable implementation ===== /** \brief * serialization */ - virtual void serialize(::std::ostream &out); + virtual void serialize(std::ostream &out); /** \brief * deserialization */ - virtual void deserialize(::std::istream &in); + virtual void deserialize(std::istream &in); - ::std::vector<FileWriterInterface*> getFileWriterList() { + std::vector<FileWriterInterface*> getFileWriterList() { return fileWriters_; }; @@ -442,7 +442,7 @@ namespace AMDiS { /** \brief * Name of this problem. */ - ::std::string name_; + std::string name_; /** \brief * FiniteElemSpace of this problem. @@ -507,7 +507,7 @@ namespace AMDiS { /** \brief * Writes the meshes and solution after the adaption loop. */ - ::std::vector<FileWriterInterface*> fileWriters_; + std::vector<FileWriterInterface*> fileWriters_; /** \brief * All actions of mesh refinement are performed by refinementManager. diff --git a/AMDiS/src/ProblemVec.h b/AMDiS/src/ProblemVec.h index d4f99ff8..7311c647 100644 --- a/AMDiS/src/ProblemVec.h +++ b/AMDiS/src/ProblemVec.h @@ -239,7 +239,7 @@ namespace AMDiS { /** \brief * Interpolates fct to \ref solution. */ - void interpolInitialSolution(::std::vector<AbstractFunction<double, WorldVector<double> >*> *fct); + void interpolInitialSolution(std::vector<AbstractFunction<double, WorldVector<double> >*> *fct); /** \brief * Adds an Operator to \ref A. @@ -327,7 +327,7 @@ namespace AMDiS { /** \brief * Returns \ref meshes_ */ - inline ::std::vector<Mesh*> getMeshes() { + inline std::vector<Mesh*> getMeshes() { return meshes_; }; @@ -344,21 +344,21 @@ namespace AMDiS { /** \brief * Returns \ref feSpaces_. */ - inline ::std::vector<FiniteElemSpace*> getFESpaces() { + inline std::vector<FiniteElemSpace*> getFESpaces() { return feSpaces_; }; /** \brief * Returns \ref componentSpaces_; */ - inline ::std::vector<FiniteElemSpace*> getComponentFESpaces() { + inline std::vector<FiniteElemSpace*> getComponentFESpaces() { return componentSpaces_; } /** \brief * Returns \ref estimator_. */ - inline ::std::vector<Estimator*> getEstimator() { + inline std::vector<Estimator*> getEstimator() { return estimator_; }; @@ -400,14 +400,14 @@ namespace AMDiS { /** \brief * Returns \ref marker_. */ - inline ::std::vector<Marker*> getMarker() { + inline std::vector<Marker*> getMarker() { return marker_; }; /** \brief * Returns \ref name_. */ - inline virtual const ::std::string& getName() { + inline virtual const std::string& getName() { return name_; }; @@ -443,7 +443,7 @@ namespace AMDiS { /** \brief * Sets \ref estimator_. */ - inline void setEstimator(::std::vector<Estimator*> est) { + inline void setEstimator(std::vector<Estimator*> est) { estimator_ = est; }; @@ -489,21 +489,21 @@ namespace AMDiS { /** \} */ - void writeResidualMesh(AdaptInfo *adaptInfo, const ::std::string name); + void writeResidualMesh(AdaptInfo *adaptInfo, const std::string name); // ===== Serializable implementation ===== /** \brief * serialization */ - virtual void serialize(::std::ostream &out); + virtual void serialize(std::ostream &out); /** \brief * deserialization */ - virtual void deserialize(::std::istream &in); + virtual void deserialize(std::istream &in); - ::std::vector<FileWriterInterface*> getFileWriterList() { + std::vector<FileWriterInterface*> getFileWriterList() { return fileWriters_; }; @@ -511,7 +511,7 @@ namespace AMDiS { /** \brief * Name of this problem. */ - ::std::string name_; + std::string name_; /** \brief * number of problem components @@ -521,32 +521,32 @@ namespace AMDiS { /** \brief * fe spaces of this problem. */ - ::std::vector<FiniteElemSpace*> feSpaces_; + std::vector<FiniteElemSpace*> feSpaces_; /** \brief * meshes of this problem. */ - ::std::vector<Mesh*> meshes_; + std::vector<Mesh*> meshes_; /** \brief * Pointer to the fe spaces for the different problem components */ - ::std::vector<FiniteElemSpace*> componentSpaces_; + std::vector<FiniteElemSpace*> componentSpaces_; /** \brief * Pointer to the meshes for the different problem components */ - ::std::vector<Mesh*> componentMeshes_; + std::vector<Mesh*> componentMeshes_; /** \brief * Responsible for element marking. */ - ::std::vector<Marker*> marker_; + std::vector<Marker*> marker_; /** \brief * Estimator of this problem. Used in \ref estimate(). */ - ::std::vector<Estimator*> estimator_; + std::vector<Estimator*> estimator_; /** \brief * Linear solver of this problem. Used in \ref solve(). @@ -575,7 +575,7 @@ namespace AMDiS { * be assembled only once. All other matrices will be assembled at every * time step. */ - ::std::vector< ::std::vector< bool > > assembleMatrixOnlyOnce_; + std::vector< std::vector< bool > > assembleMatrixOnlyOnce_; /** \brief * If [i][j] of this field is set to true, the corresponding DOFMatrix of @@ -583,7 +583,7 @@ namespace AMDiS { * to determine, if assembling of a matrix can be ommitted, if it is set * to be assembled only once. */ - ::std::vector< ::std::vector< bool > > assembledMatrix_; + std::vector< std::vector< bool > > assembledMatrix_; /** \brief * Matrix-vector multiplication @@ -608,7 +608,7 @@ namespace AMDiS { /** \brief * Writes the meshes and solution after the adaption loop. */ - ::std::vector<FileWriterInterface*> fileWriters_; + std::vector<FileWriterInterface*> fileWriters_; /** \brief * All actions of mesh refinement are performed by refinementManager. diff --git a/AMDiS/src/VtkWriter.cc b/AMDiS/src/VtkWriter.cc index a2bcefeb..0b9799b3 100644 --- a/AMDiS/src/VtkWriter.cc +++ b/AMDiS/src/VtkWriter.cc @@ -13,18 +13,18 @@ namespace AMDiS { int VtkWriter::writeFile(const char *name) { - int nVertices = (*dc_)[0]->getNumberVertices(); - int nElements = (*dc_)[0]->getNumberElements(); - int vertices = (*dc_)[0]->getMesh()->getGeo(VERTEX); + int nVertices = (*dataCollector)[0]->getNumberVertices(); + int nElements = (*dataCollector)[0]->getNumberElements(); + int vertices = (*dataCollector)[0]->getMesh()->getGeo(VERTEX); - if ((dim_ == 2) && (degree_ == 2)) { - nVertices += (*dc_)[0]->getNumberInterpPoints(); + if ((dim == 2) && (degree == 2)) { + nVertices += (*dataCollector)[0]->getNumberInterpPoints(); nElements *= 4; - } else if ((dim_ == 2) && (degree_ == 3)) { - nVertices += (*dc_)[0]->getNumberInterpPoints(); + } else if ((dim == 2) && (degree == 3)) { + nVertices += (*dataCollector)[0]->getNumberInterpPoints(); nElements *= 9; - } else if ((dim_ == 2) && (degree_ == 4)) { - nVertices += (*dc_)[0]->getNumberInterpPoints(); + } else if ((dim == 2) && (degree == 4)) { + nVertices += (*dataCollector)[0]->getNumberInterpPoints(); nElements *= 16; } @@ -78,7 +78,7 @@ namespace AMDiS { file << " </Cells>\n"; file << " <PointData>\n"; - for (int i = 0; i < static_cast<int>(dc_->size()); i++) { + for (int i = 0; i < static_cast<int>(dataCollector->size()); i++) { file << " <DataArray type=\"Float32\" Name=\"value" << i << "\" format=\"ascii\">\n"; @@ -101,7 +101,7 @@ namespace AMDiS { void VtkWriter::writeVertexCoords(std::ofstream &file) { - DOFVector< std::list<VertexInfo> > *vertexInfos = (*dc_)[0]->getVertexInfos(); + DOFVector< std::list<VertexInfo> > *vertexInfos = (*dataCollector)[0]->getVertexInfos(); DOFVector< std::list<VertexInfo> >::Iterator it(vertexInfos, USED_DOFS); int counter = 0; @@ -116,8 +116,8 @@ namespace AMDiS { } // For the second dim case, write also the interpolation points. - if ((dim_ == 2) && (degree_ > 1)) { - DOFVector< std::list< WorldVector<double> > > *interpPointCoords = (*dc_)[0]->getInterpPointCoords(); + if ((dim == 2) && (degree > 1)) { + DOFVector< std::list< WorldVector<double> > > *interpPointCoords = (*dataCollector)[0]->getInterpPointCoords(); DOFVector< std::list< WorldVector<double> > >::Iterator pointIt(interpPointCoords, USED_DOFS); for (pointIt.reset(); !pointIt.end(); ++pointIt) { @@ -136,18 +136,18 @@ namespace AMDiS { // DOFVector<double> *values; // DOFVector< std::list<WorldVector<double> > > *dofCoords; - DOFVector<int> *interpPointInd = (*dc_)[componentNo]->getInterpPointInd(); - DOFVector<double> *values = (*dc_)[componentNo]->getValues(); - DOFVector< std::list<WorldVector<double> > > *dofCoords = (*dc_)[componentNo]->getDofCoords(); + DOFVector<int> *interpPointInd = (*dataCollector)[componentNo]->getInterpPointInd(); + DOFVector<double> *values = (*dataCollector)[componentNo]->getValues(); + DOFVector< std::list<WorldVector<double> > > *dofCoords = (*dataCollector)[componentNo]->getDofCoords(); /* #ifdef _OPENMP #pragma omp critical #endif { - interpPointInd = (*dc_)[componentNo]->getInterpPointInd(); - values = (*dc_)[componentNo]->getValues(); - dofCoords = (*dc_)[componentNo]->getDofCoords(); + interpPointInd = (*dataCollector)[componentNo]->getInterpPointInd(); + values = (*dataCollector)[componentNo]->getValues(); + dofCoords = (*dataCollector)[componentNo]->getDofCoords(); } */ DOFVector<int>::Iterator intPointIt(interpPointInd, USED_DOFS); @@ -167,9 +167,9 @@ namespace AMDiS { } // For the second dim case, write also the values of the interpolation points. - if ((dim_ == 2) && (degree_ > 1)) { + if ((dim == 2) && (degree > 1)) { DOFVector< std::list<WorldVector<double> > >::Iterator - interpCoordIt((*dc_)[componentNo]->getInterpPointCoords(), USED_DOFS); + interpCoordIt((*dataCollector)[componentNo]->getInterpPointCoords(), USED_DOFS); for (intPointIt.reset(), valueIt.reset(), interpCoordIt.reset(); !intPointIt.end(); @@ -189,16 +189,16 @@ namespace AMDiS { { // For the second dim case, and if higher order Lagrange elements are used, // write the connectivity by extra functions. - if ((dim_ == 2) && (degree_ == 2)) { + if ((dim == 2) && (degree == 2)) { writeConnectivity_dim2_degree2(file); - } else if ((dim_ == 2) && (degree_ == 3)) { + } else if ((dim == 2) && (degree == 3)) { writeConnectivity_dim2_degree3(file); - } else if ((dim_ == 2) && (degree_ == 4)) { + } else if ((dim == 2) && (degree == 4)) { writeConnectivity_dim2_degree4(file); } else { - std::list<ElementInfo> *elements = (*dc_)[0]->getElementInfos(); + std::list<ElementInfo> *elements = (*dataCollector)[0]->getElementInfos(); std::list<ElementInfo>::iterator elementIt; - int vertices = (*dc_)[0]->getMesh()->getGeo(VERTEX); + int vertices = (*dataCollector)[0]->getMesh()->getGeo(VERTEX); for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) { // for all vertices @@ -213,13 +213,13 @@ namespace AMDiS { void VtkWriter::writeConnectivity_dim2_degree2(std::ofstream &file) { - std::list<ElementInfo> *elements = (*dc_)[0]->getElementInfos(); + std::list<ElementInfo> *elements = (*dataCollector)[0]->getElementInfos(); std::list<ElementInfo>::iterator elementIt; - std::vector< std::vector<int> > *interpPoints = (*dc_)[0]->getInterpPoints(); + std::vector< std::vector<int> > *interpPoints = (*dataCollector)[0]->getInterpPoints(); std::vector< std::vector<int> >::iterator pointIt; - int nVertices = (*dc_)[0]->getNumberVertices(); + int nVertices = (*dataCollector)[0]->getNumberVertices(); for (pointIt = interpPoints->begin(), elementIt = elements->begin(); pointIt != interpPoints->end(); @@ -247,13 +247,13 @@ namespace AMDiS { void VtkWriter::writeConnectivity_dim2_degree3(std::ofstream &file) { - std::list<ElementInfo> *elements = (*dc_)[0]->getElementInfos(); + std::list<ElementInfo> *elements = (*dataCollector)[0]->getElementInfos(); std::list<ElementInfo>::iterator elementIt; - std::vector< std::vector<int> > *interpPoints = (*dc_)[0]->getInterpPoints(); + std::vector< std::vector<int> > *interpPoints = (*dataCollector)[0]->getInterpPoints(); std::vector< std::vector<int> >::iterator pointIt; - int nVertices = (*dc_)[0]->getNumberVertices(); + int nVertices = (*dataCollector)[0]->getNumberVertices(); for (pointIt = interpPoints->begin(), elementIt = elements->begin(); pointIt != interpPoints->end(); @@ -303,13 +303,13 @@ namespace AMDiS { void VtkWriter::writeConnectivity_dim2_degree4(std::ofstream &file) { - std::list<ElementInfo> *elements = (*dc_)[0]->getElementInfos(); + std::list<ElementInfo> *elements = (*dataCollector)[0]->getElementInfos(); std::list<ElementInfo>::iterator elementIt; - std::vector< std::vector<int> > *interpPoints = (*dc_)[0]->getInterpPoints(); + std::vector< std::vector<int> > *interpPoints = (*dataCollector)[0]->getInterpPoints(); std::vector< std::vector<int> >::iterator pointIt; - int nVertices = (*dc_)[0]->getNumberVertices(); + int nVertices = (*dataCollector)[0]->getNumberVertices(); for (pointIt = interpPoints->begin(), elementIt = elements->begin(); pointIt != interpPoints->end(); diff --git a/AMDiS/src/VtkWriter.h b/AMDiS/src/VtkWriter.h index 1673591b..e974b61e 100644 --- a/AMDiS/src/VtkWriter.h +++ b/AMDiS/src/VtkWriter.h @@ -33,10 +33,10 @@ namespace AMDiS { { public: VtkWriter(std::vector<DataCollector*> *dc) - : dc_(dc) + : dataCollector(dc) { - degree_ = (*dc_)[0]->getFeSpace()->getBasisFcts()->getDegree(); - dim_ = (*dc_)[0]->getMesh()->getDim(); + degree = (*dataCollector)[0]->getFeSpace()->getBasisFcts()->getDegree(); + dim = (*dataCollector)[0]->getMesh()->getDim(); }; @@ -103,26 +103,26 @@ namespace AMDiS { for (int i = Global::getGeo(WORLD); i < 3; i++) { file << " 0.0"; } - file << std::endl; + file << "\n"; } private: /** * List of DataCollectors, for each component of the problem one. */ - std::vector<DataCollector*> *dc_; + std::vector<DataCollector*> *dataCollector; /** \brief * Degree of the basis function of the problem. */ - int degree_; + int degree; /** \brief * Dimension of the geometry. */ - int dim_; + int dim; }; } -- GitLab