Skip to content
Snippets Groups Projects
Commit ecfb6ed2 authored by Emilie Marchandise's avatar Emilie Marchandise
Browse files

PLugin Distance to physical entities rather than elementary

parent f46002ac
Branches
Tags
No related merge requests found
...@@ -28,6 +28,7 @@ StringXNumber DistanceOptions_Number[] = { ...@@ -28,6 +28,7 @@ StringXNumber DistanceOptions_Number[] = {
{GMSH_FULLRC, "Line", NULL, 0.}, {GMSH_FULLRC, "Line", NULL, 0.},
{GMSH_FULLRC, "Surface", NULL, 0.}, {GMSH_FULLRC, "Surface", NULL, 0.},
{GMSH_FULLRC, "Computation", NULL, 1.0}, {GMSH_FULLRC, "Computation", NULL, 1.0},
{GMSH_FULLRC, "Threshold", NULL, 1.0},
//{GMSH_FULLRC, "Scale", NULL, 0.}, //{GMSH_FULLRC, "Scale", NULL, 0.},
//{GMSH_FULLRC, "Min Scale", NULL, 1.e-3}, //{GMSH_FULLRC, "Min Scale", NULL, 1.e-3},
//{GMSH_FULLRC, "Max Scale", NULL, 1} //{GMSH_FULLRC, "Max Scale", NULL, 1}
...@@ -52,11 +53,11 @@ std::string GMSH_DistancePlugin::getHelp() const ...@@ -52,11 +53,11 @@ std::string GMSH_DistancePlugin::getHelp() const
return "Plugin(Distance) computes distances to elementary entities in " return "Plugin(Distance) computes distances to elementary entities in "
"a mesh.\n\n" "a mesh.\n\n"
"Define the elementary entities to which the distance is computed. If Point=0, Line=0, and Surface=0, then the distance is computed to all the boundaries of the mesh (edges in 2D and faces in 3D)\n\n" "Define the physical entities to which the distance is computed. If Point=0, Line=0, and Surface=0, then the distance is computed to all the boundaries of the mesh (edges in 2D and faces in 3D)\n\n"
"Computation<0. computes the geometrical euclidian distance (warning: different than the geodesic distance), and Computation=a>0.0 solves a PDE on the mesh with the diffusion constant mu = a*bbox, with bbox being the max size of the bounding box of the mesh (see paper Legrand 2006) \n\n" "Computation<0. computes the geometrical euclidian distance (warning: different than the geodesic distance), and Computation=a>0.0 solves a PDE on the mesh with the diffusion constant mu = a*bbox, with bbox being the max size of the bounding box of the mesh (see paper Legrand 2006) \n\n"
"Plugin(Distance) creates a new distance view and also saves the view in the fileName.pos file."; "Plugin(Distance) creates a new distance view and also saves the view in the fileName.pos file. It also creates the orthogonal view to the distance field.";
} }
int GMSH_DistancePlugin::getNbOptions() const int GMSH_DistancePlugin::getNbOptions() const
...@@ -87,6 +88,7 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -87,6 +88,7 @@ PView *GMSH_DistancePlugin::execute(PView *v)
int id_line = (int) DistanceOptions_Number[1].def; int id_line = (int) DistanceOptions_Number[1].def;
int id_face = (int) DistanceOptions_Number[2].def; int id_face = (int) DistanceOptions_Number[2].def;
double type = (double) DistanceOptions_Number[3].def; double type = (double) DistanceOptions_Number[3].def;
double dMax = (double) DistanceOptions_Number[4].def;
PView *view = new PView(); PView *view = new PView();
PViewDataList *data = getDataList(view); PViewDataList *data = getDataList(view);
...@@ -142,11 +144,15 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -142,11 +144,15 @@ PView *GMSH_DistancePlugin::execute(PView *v)
GEntity* g2 = entities[i]; GEntity* g2 = entities[i];
int tag = g2->tag(); int tag = g2->tag();
int gDim = g2->dim(); int gDim = g2->dim();
std::vector<int> phys = g2->getPhysicalEntities();
bool computeForEntity = false; bool computeForEntity = false;
if (id_pt==0 && id_line==0 && id_face==0 && gDim==maxDim-1 ) for(int k = 0; k< phys.size(); k++){
computeForEntity = true; int tagp = phys[k];
else if ( (tag==id_pt && gDim==0)|| (tag==id_line && gDim==1) || (tag==id_face && gDim==2) ) if (id_pt==0 && id_line==0 && id_face==0 && gDim==maxDim-1 )
computeForEntity = true; computeForEntity = true;
else if ( (tagp==id_pt && gDim==0)|| (tagp==id_line && gDim==1) || (tagp==id_face && gDim==2) )
computeForEntity = true;
}
if (computeForEntity){ if (computeForEntity){
for(unsigned int k = 0; k < g2->getNumMeshElements(); k++){ for(unsigned int k = 0; k < g2->getNumMeshElements(); k++){
std::vector<double> iDistances; std::vector<double> iDistances;
...@@ -175,7 +181,7 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -175,7 +181,7 @@ PView *GMSH_DistancePlugin::execute(PView *v)
} }
} }
// std::map<int, std::vector<GEntity*> > groups[4]; // std::map<int, std::vector<GEntity*> > groups[4];
// getPhysicalGroups(groups); // GModel::current()->getPhysicalGroups(groups);
// std::map<int, std::vector<GEntity*> >::const_iterator it = groups[1].find(100); // std::map<int, std::vector<GEntity*> >::const_iterator it = groups[1].find(100);
// if(it == groups[1].end()) return 0; // if(it == groups[1].end()) return 0;
// const std::vector<GEntity *> &physEntities = it->second; // const std::vector<GEntity *> &physEntities = it->second;
...@@ -235,10 +241,14 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -235,10 +241,14 @@ PView *GMSH_DistancePlugin::execute(PView *v)
int tag = ge->tag(); int tag = ge->tag();
int gDim = ge->dim(); int gDim = ge->dim();
bool fixForEntity = false; bool fixForEntity = false;
if(id_pt==0 && id_line==0 && id_face==0 && gDim < maxDim) std::vector<int> phys = ge->getPhysicalEntities();
fixForEntity = true; for(int k = 0; k< phys.size(); k++){
else if ( (tag==id_pt && gDim==0)|| (tag==id_line && gDim==1) || (tag==id_face && gDim==2) ) int tagp = phys[k];
fixForEntity = true; if (id_pt==0 && id_line==0 && id_face==0 && gDim==maxDim-1 )
fixForEntity = true;
else if ( (tagp==id_pt && gDim==0)|| (tagp==id_line && gDim==1) || (tagp==id_face && gDim==2) )
fixForEntity = true;
}
if (fixForEntity){ if (fixForEntity){
for(unsigned int i = 0; i < ge->getNumMeshElements(); ++i){ for(unsigned int i = 0; i < ge->getNumMeshElements(); ++i){
MElement *t = ge->getMeshElement(i); MElement *t = ge->getMeshElement(i);
...@@ -348,8 +358,6 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -348,8 +358,6 @@ PView *GMSH_DistancePlugin::execute(PView *v)
dofManager<double> myAssembler(lsys2); dofManager<double> myAssembler(lsys2);
simpleFunction<double> ONE(1.0); simpleFunction<double> ONE(1.0);
double dMax = 0.03;
std::vector<MElement *> allElems; std::vector<MElement *> allElems;
for(unsigned int ii = 0; ii < entities.size(); ii++){ for(unsigned int ii = 0; ii < entities.size(); ii++){
if(entities[ii]->dim() == maxDim) { if(entities[ii]->dim() == maxDim) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment