Skip to content
Snippets Groups Projects
Commit fb50ad26 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

cleanup

parent 0d7b9e7d
No related branches found
No related tags found
No related merge requests found
...@@ -635,7 +635,7 @@ if(HAVE_MESH) ...@@ -635,7 +635,7 @@ if(HAVE_MESH)
endif(ENABLE_TETGEN AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Tetgen1.5/tetgen.h) endif(ENABLE_TETGEN AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Tetgen1.5/tetgen.h)
if(HAVE_TETGEN) if(HAVE_TETGEN)
message("WARNING: By including Tetgen you have to comply with Tetgen's " message("WARNING: By including Tetgen you have to comply with Tetgen's "
"special licensing requirements stated in contrib/Tetgen/LICENSE.") "special licensing requirements stated in contrib/Tetgen*/LICENSE.")
endif(HAVE_TETGEN) endif(HAVE_TETGEN)
endif(HAVE_MESH) endif(HAVE_MESH)
......
...@@ -326,7 +326,8 @@ void Filler::treat_model(){ ...@@ -326,7 +326,8 @@ void Filler::treat_model(){
void Filler::treat_region(GRegion* gr){ void Filler::treat_region(GRegion* gr){
#if defined(HAVE_RTREE) #if defined(HAVE_RTREE)
int i,j; unsigned int i;
int j;
int count; int count;
bool ok; bool ok;
double x,y,z; double x,y,z;
......
...@@ -99,7 +99,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities, ...@@ -99,7 +99,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities,
double minDist=1.e4; double minDist=1.e4;
double maxDist=0.0; double maxDist=0.0;
for (std::map<MVertex*,double >::iterator itv=_distance_map.begin(); itv!=_distance_map.end(); ++itv){ for (std::map<MVertex*,double >::iterator itv=_distance_map.begin();
itv != _distance_map.end(); ++itv){
double dist = itv->second; double dist = itv->second;
if (dist>maxDist) maxDist = dist; if (dist>maxDist) maxDist = dist;
if (dist<minDist) minDist = dist; if (dist<minDist) minDist = dist;
...@@ -138,7 +139,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities, ...@@ -138,7 +139,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities,
case 2: fprintf(fName,"SL("); break; case 2: fprintf(fName,"SL("); break;
case 3: fprintf(fName,"ST("); break; case 3: fprintf(fName,"ST("); break;
case 4: fprintf(fName,"SQ("); break; case 4: fprintf(fName,"SQ("); break;
default: Msg::Error("Error in Plugin 'Distance' (numNodes=%d).",numNodes); break; default: Msg::Error("Error in Plugin 'Distance' (numNodes=%d)",
numNodes); break;
} }
else if (_maxDim == 3) else if (_maxDim == 3)
switch (numNodes) { switch (numNodes) {
...@@ -146,7 +148,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities, ...@@ -146,7 +148,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities,
case 8: fprintf(fName,"SH("); break; case 8: fprintf(fName,"SH("); break;
case 6: fprintf(fName,"SI("); break; case 6: fprintf(fName,"SI("); break;
case 5: fprintf(fName,"SY("); break; case 5: fprintf(fName,"SY("); break;
default: Msg::Error("Error in Plugin 'Distance' (numNodes=%d).",numNodes); break; default: Msg::Error("Error in Plugin 'Distance' (numNodes=%d)",
numNodes); break;
} }
std::vector<double> dist; std::vector<double> dist;
...@@ -163,7 +166,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities, ...@@ -163,7 +166,8 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities,
fprintf(fName,"){"); fprintf(fName,"){");
for (unsigned int i=0; i<dist.size(); i++) { for (unsigned int i=0; i<dist.size(); i++) {
if (_minScale>0 && _maxScale>0) if (_minScale>0 && _maxScale>0)
dist[i] = _minScale+((dist[i]-minDist)/(maxDist-minDist))*(_maxScale-_minScale); dist[i] = _minScale + ((dist[i] - minDist) / (maxDist - minDist)) *
(_maxScale - _minScale);
else if (_minScale>0 && _maxScale<0) else if (_minScale>0 && _maxScale<0)
dist[i] = _minScale + dist[i]; dist[i] = _minScale + dist[i];
out->push_back(dist[i]); out->push_back(dist[i]);
...@@ -271,15 +275,15 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -271,15 +275,15 @@ PView *GMSH_DistancePlugin::execute(PView *v)
for (unsigned int i=0; i<_entities.size(); i++) { for (unsigned int i=0; i<_entities.size(); i++) {
GEntity* g2 = _entities[i]; GEntity* g2 = _entities[i];
int tag = g2->tag();
int gDim = g2->dim(); int gDim = g2->dim();
std::vector<int> phys = g2->getPhysicalEntities(); std::vector<int> phys = g2->getPhysicalEntities();
bool computeForEntity = false; bool computeForEntity = false;
for(int k = 0; k<phys.size(); k++) { for(unsigned int k = 0; k<phys.size(); k++) {
int tagp = phys[k]; int tagp = phys[k];
if (id_pt == 0 && id_line == 0 && id_face == 0 && gDim == _maxDim - 1) 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) ) else if ((tagp == id_pt && gDim == 0) || (tagp == id_line && gDim == 1) ||
(tagp == id_face && gDim == 2))
computeForEntity = true; computeForEntity = true;
} }
if (computeForEntity) { if (computeForEntity) {
...@@ -294,10 +298,12 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -294,10 +298,12 @@ PView *GMSH_DistancePlugin::execute(PView *v)
MVertex *v2 = e->getVertex(1); MVertex *v2 = e->getVertex(1);
SPoint3 p1(v1->x(), v1->y(), v1->z()); SPoint3 p1(v1->x(), v1->y(), v1->z());
SPoint3 p2(v2->x(), v2->y(), v2->z()); SPoint3 p2(v2->x(), v2->y(), v2->z());
if ((e->getNumVertices() == 2 && order==1) || (e->getNumVertices() == 3 && order==2)) { if ((e->getNumVertices() == 2 && order == 1) ||
(e->getNumVertices() == 3 && order == 2)) {
signedDistancesPointsLine(iDistances, iClosePts, pts, p1, p2); signedDistancesPointsLine(iDistances, iClosePts, pts, p1, p2);
} }
else if ((e->getNumVertices() == 3 && order == 1) || (e->getNumVertices() == 6 && order==2)) { else if ((e->getNumVertices() == 3 && order == 1) ||
(e->getNumVertices() == 6 && order == 2)) {
MVertex *v3 = e->getVertex(2); MVertex *v3 = e->getVertex(2);
SPoint3 p3 (v3->x(),v3->y(),v3->z()); SPoint3 p3 (v3->x(),v3->y(),v3->z());
signedDistancesPointsTriangle(iDistances, iClosePts, pts, p1, p2, p3); signedDistancesPointsTriangle(iDistances, iClosePts, pts, p1, p2, p3);
...@@ -339,15 +345,15 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -339,15 +345,15 @@ PView *GMSH_DistancePlugin::execute(PView *v)
SBoundingBox3d bbox; SBoundingBox3d bbox;
for(unsigned int i = 0; i < _entities.size(); i++){ for(unsigned int i = 0; i < _entities.size(); i++){
GEntity* ge = _entities[i]; GEntity* ge = _entities[i];
int tag = ge->tag();
int gDim = ge->dim(); int gDim = ge->dim();
bool fixForEntity = false; bool fixForEntity = false;
std::vector<int> phys = ge->getPhysicalEntities(); std::vector<int> phys = ge->getPhysicalEntities();
for(int k=0; k<phys.size(); k++) { for(unsigned int k = 0; k < phys.size(); k++) {
int tagp = phys[k]; int tagp = phys[k];
if (id_pt == 0 && id_line == 0 && id_face == 0 && gDim == _maxDim - 1) if (id_pt == 0 && id_line == 0 && id_face == 0 && gDim == _maxDim - 1)
fixForEntity = true; fixForEntity = true;
else if ( (tagp==id_pt && gDim==0) || (tagp==id_line && gDim==1) || (tagp==id_face && gDim==2) ) else if ((tagp == id_pt && gDim == 0) || (tagp == id_line && gDim == 1) ||
(tagp == id_face && gDim == 2) )
fixForEntity = true; fixForEntity = true;
} }
if (fixForEntity) { if (fixForEntity) {
...@@ -389,7 +395,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -389,7 +395,8 @@ PView *GMSH_DistancePlugin::execute(PView *v)
simpleFunction<double> DIFF(mu*mu), ONE(1.0); simpleFunction<double> DIFF(mu*mu), ONE(1.0);
distanceTerm distance(GModel::current(), 1, &DIFF, &ONE); distanceTerm distance(GModel::current(), 1, &DIFF, &ONE);
for (std::vector<MElement* >::iterator it = allElems.begin(); it != allElems.end(); it++){ for (std::vector<MElement* >::iterator it = allElems.begin();
it != allElems.end(); it++){
SElement se((*it)); SElement se((*it));
distance.addToMatrix(*dofView, &se); distance.addToMatrix(*dofView, &se);
} }
...@@ -420,7 +427,6 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -420,7 +427,6 @@ PView *GMSH_DistancePlugin::execute(PView *v)
_data->setFileName(_fileName.c_str()); _data->setFileName(_fileName.c_str());
_data->finalize(); _data->finalize();
// compute also orthogonal vector to distance field // compute also orthogonal vector to distance field
// A Uortho = -C DIST // A Uortho = -C DIST
//------------------------------------------------ //------------------------------------------------
...@@ -463,7 +469,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -463,7 +469,8 @@ PView *GMSH_DistancePlugin::execute(PView *v)
MVertex *vFIX = e->getVertex(0); MVertex *vFIX = e->getVertex(0);
myAssembler.fixVertex(vFIX, 0, 1, 0.0); myAssembler.fixVertex(vFIX, 0, 1, 0.0);
for (std::vector<MElement* >::iterator it = allElems.begin(); it != allElems.end(); it++){ for (std::vector<MElement* >::iterator it = allElems.begin();
it != allElems.end(); it++){
MElement *t = *it; MElement *t = *it;
for(int k = 0; k < t->getNumVertices(); k++) for(int k = 0; k < t->getNumVertices(); k++)
myAssembler.numberVertex(t->getVertex(k), 0, 1); myAssembler.numberVertex(t->getVertex(k), 0, 1);
...@@ -476,7 +483,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -476,7 +483,8 @@ PView *GMSH_DistancePlugin::execute(PView *v)
// else // else
// ortho = new orthogonalTerm(GModel::current(), 1, &ONE, dofView); // ortho = new orthogonalTerm(GModel::current(), 1, &ONE, dofView);
for (std::vector<MElement* >::iterator it = allElems.begin(); it != allElems.end(); it++){ for (std::vector<MElement* >::iterator it = allElems.begin();
it != allElems.end(); it++){
SElement se((*it)); SElement se((*it));
ortho->addToMatrix(myAssembler, &se); ortho->addToMatrix(myAssembler, &se);
} }
...@@ -494,7 +502,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) ...@@ -494,7 +502,8 @@ PView *GMSH_DistancePlugin::execute(PView *v)
Msg::Info("Writing orthogonal.pos"); Msg::Info("Writing orthogonal.pos");
FILE * f5 = fopen("orthogonal.pos","w"); FILE * f5 = fopen("orthogonal.pos","w");
fprintf(f5,"View \"orthogonal\"{\n"); fprintf(f5,"View \"orthogonal\"{\n");
for (std::vector<MElement* >::iterator it = allElems.begin(); it != allElems.end(); it++){ for (std::vector<MElement* >::iterator it = allElems.begin();
it != allElems.end(); it++){
MElement *e = *it; MElement *e = *it;
int numNodes = e->getNumVertices(); int numNodes = e->getNumVertices();
......
...@@ -169,7 +169,7 @@ bool PViewDataGModel::finalize(bool computeMinMax, const std::string &interpolat ...@@ -169,7 +169,7 @@ bool PViewDataGModel::finalize(bool computeMinMax, const std::string &interpolat
// for which we know the interpolation: it's constant) // for which we know the interpolation: it's constant)
int types[] = {TYPE_PNT, TYPE_LIN, TYPE_TRI, TYPE_QUA, TYPE_TET, TYPE_HEX, int types[] = {TYPE_PNT, TYPE_LIN, TYPE_TRI, TYPE_QUA, TYPE_TET, TYPE_HEX,
TYPE_PRI, TYPE_PYR, TYPE_POLYG, TYPE_POLYH}; TYPE_PRI, TYPE_PYR, TYPE_POLYG, TYPE_POLYH};
for(int i = 0; i < sizeof(types) / sizeof(types[0]); i++){ for(unsigned int i = 0; i < sizeof(types) / sizeof(types[0]); i++){
if(!haveInterpolationMatrices(types[i])){ if(!haveInterpolationMatrices(types[i])){
MElement *e = _getOneElementOfGivenType(model, types[i]); MElement *e = _getOneElementOfGivenType(model, types[i]);
if(e){ if(e){
......
...@@ -215,7 +215,7 @@ void PViewDataList::_stat(std::vector<double> &list, int nbcomp, int nbelm, ...@@ -215,7 +215,7 @@ void PViewDataList::_stat(std::vector<double> &list, int nbcomp, int nbelm,
} }
int nb = list.size() / nbelm; int nb = list.size() / nbelm;
for(unsigned int ele = 0; ele < nbelm; ele ++){ for(int ele = 0; ele < nbelm; ele ++){
int i = ele * nb; int i = ele * nb;
if(type == TYPE_POLYG || type == TYPE_POLYH){ if(type == TYPE_POLYG || type == TYPE_POLYH){
int t = (type == TYPE_POLYG) ? 0 : 1; int t = (type == TYPE_POLYG) ? 0 : 1;
......
This diff is collapsed.
...@@ -16,11 +16,14 @@ class orthogonalTerm : public helmholtzTerm<double> { ...@@ -16,11 +16,14 @@ class orthogonalTerm : public helmholtzTerm<double> {
bool withDof; bool withDof;
std::map<MVertex*, double > *_distance_map; std::map<MVertex*, double > *_distance_map;
public: public:
orthogonalTerm(GModel *gm, int iField, simpleFunction<double> *k, std::map<MVertex*, double > *distance_map) orthogonalTerm(GModel *gm, int iField, simpleFunction<double> *k,
: helmholtzTerm<double>(gm, iField, iField, k, 0), _distance_map(distance_map), withDof(false) {} std::map<MVertex*, double > *distance_map)
: helmholtzTerm<double>(gm, iField, iField, k, 0), withDof(false),
_distance_map(distance_map) {}
orthogonalTerm(GModel *gm, int iField, simpleFunction<double> *k, PView *pview) orthogonalTerm(GModel *gm, int iField, simpleFunction<double> *k, PView *pview)
: helmholtzTerm<double>(gm, iField, iField, k, 0), _pview(pview), withDof(false) {} : helmholtzTerm<double>(gm, iField, iField, k, 0), _pview(pview), withDof(false) {}
orthogonalTerm(GModel *gm, int iField, simpleFunction<double> *k, dofManager<double> *dofView) orthogonalTerm(GModel *gm, int iField, simpleFunction<double> *k,
dofManager<double> *dofView)
: helmholtzTerm<double>(gm, iField, iField, k, 0), _dofView(dofView), withDof(true) {} : helmholtzTerm<double>(gm, iField, iField, k, 0), _dofView(dofView), withDof(true) {}
void elementVector(SElement *se, fullVector<double> &m) const void elementVector(SElement *se, fullVector<double> &m) const
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment