diff --git a/contrib/arc/Classes/VectorXFEMFS.cpp b/contrib/arc/Classes/VectorXFEMFS.cpp index 0257484186ad2be7567a123cc0b61286019aa56e..937c76ee4c8618160c1f14efc5fc645ba4e39b6e 100644 --- a/contrib/arc/Classes/VectorXFEMFS.cpp +++ b/contrib/arc/Classes/VectorXFEMFS.cpp @@ -13,7 +13,9 @@ void ScalarLagrangeToXfemFS::f(MVertex *ver, std::vector<ValType> &vals) { - if (!(*_TagEnrichedVertex)[ver->getNum()]) vals.push_back(1.0); + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ver->getNum()); + if (it==_TagEnrichedVertex->end()) vals.push_back(1.0); else { double func = (*_funcEnrichment)(ver->x(),ver->y(),ver->z()); @@ -39,7 +41,9 @@ void ScalarLagrangeToXfemFS::f(MElement *ele, double u, double v, double w, std: for (int i=0 ;i<ele->getNumVertices();i++) { - if ((*_TagEnrichedVertex)[ele->getVertex(i)->getNum()]) ndofs = ndofs + 1; // enriched dof + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ele->getVertex(i)->getNum()); + if (it!=_TagEnrichedVertex->end()) ndofs = ndofs + 1; // enriched dof } int curpos=vals.size(); @@ -51,7 +55,9 @@ void ScalarLagrangeToXfemFS::f(MElement *ele, double u, double v, double w, std: int k=0; for (int i=0 ;i<ele->getNumVertices();i++) { - if ((*_TagEnrichedVertex)[ele->getVertex(i)->getNum()]) + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ele->getVertex(i)->getNum()); + if (it!=_TagEnrichedVertex->end()) { vals[curpos+normaldofs+k] = vals[curpos+i]*func; // enriched dof k++; @@ -77,7 +83,9 @@ void ScalarLagrangeToXfemFS::gradf(MElement *ele, double u, double v, double w,s for (int i=0 ;i< (ele->getNumVertices());i++) { - if ((*_TagEnrichedVertex)[ele->getVertex(i)->getNum()]) ndofs = ndofs + 1; // enriched dof + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ele->getVertex(i)->getNum()); + if (it!=_TagEnrichedVertex->end()){ndofs = ndofs + 1;} // enriched dof } int curpos = grads.size(); @@ -88,7 +96,9 @@ void ScalarLagrangeToXfemFS::gradf(MElement *ele, double u, double v, double w,s int k = 0; for (int i=0 ;i<(ele->getNumVertices());i++) { - if ((*_TagEnrichedVertex)[ele->getVertex(i)->getNum()]) // enriched dof + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ele->getVertex(i)->getNum()); + if (it!=_TagEnrichedVertex->end()) // enriched dof { gradsuvw[curpos+normaldofs+k][0] = gradsuvw[curpos+i][0]*func; gradsuvw[curpos+normaldofs+k][1] = gradsuvw[curpos+i][1]*func; @@ -121,7 +131,9 @@ int ScalarLagrangeToXfemFS::getNumKeys(MElement *ele) { for (int i=0 ;i<(ele->getNumVertices());i++) { - if ((*_TagEnrichedVertex)[ele->getVertex(i)->getNum()]) ndofs = ndofs + 1; + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ele->getVertex(i)->getNum()); + if (it!=_TagEnrichedVertex->end()) ndofs = ndofs + 1; } } return ndofs; @@ -129,8 +141,10 @@ int ScalarLagrangeToXfemFS::getNumKeys(MElement *ele) int ScalarLagrangeToXfemFS::getNumKeys(MVertex *ver) { - if (!(*_TagEnrichedVertex)[ver->getNum()]) return 1 ; - else return 2; // if enriched vertex, there is two dof at this vertex (one dimension) + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ver->getNum()); + if (it!=_TagEnrichedVertex->end()) return 2 ; + else return 1; // if enriched vertex, there is two dof at this vertex (one dimension) } void ScalarLagrangeToXfemFS::getKeys(MElement *ele, std::vector<Dof> &keys) @@ -146,7 +160,9 @@ void ScalarLagrangeToXfemFS::getKeys(MElement *ele, std::vector<Dof> &keys) for (int i=0 ;i<(ele->getNumVertices());i++) { - if ((*_TagEnrichedVertex)[ele->getVertex(i)->getNum()]) ndofs = ndofs + 1; + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ele->getVertex(i)->getNum()); + if (it!=_TagEnrichedVertex->end()) ndofs = ndofs + 1; } keys.reserve(keys.size()+ndofs); @@ -167,7 +183,9 @@ void ScalarLagrangeToXfemFS::getKeys(MElement *ele, std::vector<Dof> &keys) void ScalarLagrangeToXfemFS::getKeys(MVertex *ver, std::vector<Dof> &keys) { - if ((*_TagEnrichedVertex)[ver->getNum()]) + std::set<int>::iterator it; + it = _TagEnrichedVertex->find(ver->getNum()); + if (it!=_TagEnrichedVertex->end()) { keys.push_back(Dof(ver->getNum(), _iField)); keys.push_back(Dof(ver->getNum(), _iField+1)); // we tag the additional dof with number field+1 diff --git a/contrib/arc/Classes/VectorXFEMFS.h b/contrib/arc/Classes/VectorXFEMFS.h index 92132fef335dcef94572e90484aa7284147869aa..23c577f38d332963ce17d23f511ee81e093eae16 100644 --- a/contrib/arc/Classes/VectorXFEMFS.h +++ b/contrib/arc/Classes/VectorXFEMFS.h @@ -16,6 +16,7 @@ #include "Numeric.h" #include "MElement.h" #include "dofManager.h" +#include <set> #include "functionSpace.h" @@ -33,12 +34,12 @@ class ScalarLagrangeToXfemFS : public ScalarLagrangeFunctionSpace{ protected: - std::map<int , bool> *_TagEnrichedVertex; + std::set<int > *_TagEnrichedVertex; simpleFunction<double> *_funcEnrichment; public: // - ScalarLagrangeToXfemFS(int i, std::map<int , bool> &TagEnrichedVertex, simpleFunction<double> *funcEnrichment) : ScalarLagrangeFunctionSpace(i) + ScalarLagrangeToXfemFS(int i, std::set<int > &TagEnrichedVertex, simpleFunction<double> *funcEnrichment) : ScalarLagrangeFunctionSpace(i) { _TagEnrichedVertex = & TagEnrichedVertex; _funcEnrichment = funcEnrichment; @@ -77,19 +78,19 @@ class ScalarXFEMToVectorFS : public ScalarToAnyFunctionSpace<SVector3> typedef TensorialTraits<SVector3>::DivType DivType; typedef TensorialTraits<SVector3>::CurlType CurlType; - ScalarXFEMToVectorFS(int id , std::map<int , bool> & TagEnrichedVertex , simpleFunction<double> * funcEnrichment) : + ScalarXFEMToVectorFS(int id , std::set<int > & TagEnrichedVertex , simpleFunction<double> * funcEnrichment) : ScalarToAnyFunctionSpace<SVector3>::ScalarToAnyFunctionSpace(ScalarLagrangeToXfemFS(id,TagEnrichedVertex,funcEnrichment), SVector3(1.,0.,0.),VECTOR_X, SVector3(0.,1.,0.),VECTOR_Y,SVector3(0.,0.,1.),VECTOR_Z) {} - ScalarXFEMToVectorFS(int id,Along comp1, std::map<int , bool> &TagEnrichedVertex , simpleFunction<double> * funcEnrichment) : + ScalarXFEMToVectorFS(int id,Along comp1, std::set<int > &TagEnrichedVertex , simpleFunction<double> * funcEnrichment) : ScalarToAnyFunctionSpace<SVector3>::ScalarToAnyFunctionSpace(ScalarLagrangeToXfemFS(id,TagEnrichedVertex,funcEnrichment), BasisVectors[comp1],comp1) {} - ScalarXFEMToVectorFS(int id,Along comp1,Along comp2, std::map<int , bool> &TagEnrichedVertex,simpleFunction<double> *funcEnrichment) : + ScalarXFEMToVectorFS(int id,Along comp1,Along comp2, std::set<int > &TagEnrichedVertex,simpleFunction<double> *funcEnrichment) : ScalarToAnyFunctionSpace<SVector3>::ScalarToAnyFunctionSpace(ScalarLagrangeToXfemFS(id,TagEnrichedVertex,funcEnrichment), BasisVectors[comp1],comp1, BasisVectors[comp2],comp2) {} - ScalarXFEMToVectorFS(int id,Along comp1,Along comp2, Along comp3, std::map<int , bool> &TagEnrichedVertex,simpleFunction<double> *funcEnrichment) : + ScalarXFEMToVectorFS(int id,Along comp1,Along comp2, Along comp3, std::set<int > &TagEnrichedVertex,simpleFunction<double> *funcEnrichment) : ScalarToAnyFunctionSpace<SVector3>::ScalarToAnyFunctionSpace(ScalarLagrangeToXfemFS(id,TagEnrichedVertex,funcEnrichment), BasisVectors[comp1],comp1, BasisVectors[comp2],comp2, BasisVectors[comp3],comp3) {} }; diff --git a/contrib/arc/Classes/XFEMelasticitySolver.cpp b/contrib/arc/Classes/XFEMelasticitySolver.cpp index e2624c411080387438bfddcd091a0a5252633060..5a45cdb0d8fee832e833fb955612bdf8056063ad 100644 --- a/contrib/arc/Classes/XFEMelasticitySolver.cpp +++ b/contrib/arc/Classes/XFEMelasticitySolver.cpp @@ -72,14 +72,7 @@ void XFEMelasticitySolver::solve(){ { for (int k = 0; k < e->getParent()->getNumVertices(); ++k) { // for all vertices in the element parent - _TagEnrichedVertex[e->getParent()->getVertex(k)->getNum()] = true; - } - } - else - { - for (int k = 0; k < e->getNumVertices(); ++k) - { - _TagEnrichedVertex[e->getVertex(k)->getNum()] = false; + _TagEnrichedVertex.insert(e->getParent()->getVertex(k)->getNum()); } } } diff --git a/contrib/arc/Classes/XFEMelasticitySolver.h b/contrib/arc/Classes/XFEMelasticitySolver.h index 2c587069c60f619cb09f3369c55e788f18afb6b9..408947f70f7cfcaf1ba0ec2eecac49bef07f0702 100644 --- a/contrib/arc/Classes/XFEMelasticitySolver.h +++ b/contrib/arc/Classes/XFEMelasticitySolver.h @@ -18,7 +18,7 @@ class XFEMelasticitySolver : public elasticitySolver { protected : // map containing the tag of vertex and enriched status - std::map<int , bool> _TagEnrichedVertex; + std::set<int > _TagEnrichedVertex; // simple multiplying function enrichment to enrich the space function simpleFunction <double> *_funcEnrichment; diff --git a/contrib/arc/XFEMElasticity.cpp b/contrib/arc/XFEMElasticity.cpp index 17b5246974172e11225c7f3adf8f16ac56f2cf88..e01cd7289e7a411631c26b6d0b8464d1931a2435 100644 --- a/contrib/arc/XFEMElasticity.cpp +++ b/contrib/arc/XFEMElasticity.cpp @@ -25,7 +25,7 @@ int main (int argc, char* argv[]) if (argc < 2) { - printf("usage : elasticity input_file_name yeahhh \n"); + printf("usage : elasticity input_file_name\n"); return -1; }