Skip to content
Snippets Groups Projects
Commit fb7edb96 authored by Laurent Van Migroet's avatar Laurent Van Migroet
Browse files

Added

getTypeOfElements  and addThisTypeOfElement
to GEntities

added
getTypeOfElements  from Gentities and Physical Groups in GModel
parent d0324a85
No related branches found
No related tags found
No related merge requests found
// $Id: GEdge.cpp,v 1.40 2008-02-21 12:11:12 geuzaine Exp $ // $Id: GEdge.cpp,v 1.41 2008-02-22 17:58:12 miegroet Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -190,3 +190,12 @@ double GEdge::length(const double &u0, const double &u1, const int nbQuadPoints) ...@@ -190,3 +190,12 @@ double GEdge::length(const double &u0, const double &u1, const int nbQuadPoints)
return L; return L;
#endif #endif
} }
void GEdge::getTypeOfElements(std::vector<int> &groups)
{
for(unsigned int j = 0; j < lines.size(); j++)
{
int type = lines[j]->getTypeForMSH();
this->addThisTypeOfElement(type,groups);
}
}
\ No newline at end of file
...@@ -113,6 +113,9 @@ class GEdge : public GEntity { ...@@ -113,6 +113,9 @@ class GEdge : public GEntity {
// True if start == end and no more than 2 segments // True if start == end and no more than 2 segments
bool isMeshDegenerated() const{ return (v0 == v1 && mesh_vertices.size() < 2); } bool isMeshDegenerated() const{ return (v0 == v1 && mesh_vertices.size() < 2); }
// Returns each type of element in the gentity
void getTypeOfElements(std::vector<int> &groups);
struct { struct {
char Method; char Method;
double coeffTransfinite; double coeffTransfinite;
......
// $Id: GEntity.cpp,v 1.18 2008-02-17 08:47:58 geuzaine Exp $ // $Id: GEntity.cpp,v 1.19 2008-02-22 17:58:12 miegroet Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -90,3 +90,19 @@ std::string GEntity::getInfoString() ...@@ -90,3 +90,19 @@ std::string GEntity::getInfoString()
return out; return out;
} }
inline
void GEntity::addThisTypeOfElement(int type,std::vector<int> &groups)
{
unsigned int size=groups.size();
if(size==0)
groups.push_back(type);
for(unsigned int i=0;i<size;i++)
{
if(type==groups[i])
break;
else
groups.push_back(type);
}
}
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <list> #include <list>
#include <vector> #include <vector>
#include <string> #include <string>
#include <map>
#include "Range.h" #include "Range.h"
#include "SPoint3.h" #include "SPoint3.h"
#include "SBoundingBox3d.h" #include "SBoundingBox3d.h"
...@@ -244,6 +245,9 @@ class GEntity { ...@@ -244,6 +245,9 @@ class GEntity {
// Vertex arrays to draw the mesh efficiently // Vertex arrays to draw the mesh efficiently
VertexArray *va_lines, *va_triangles; VertexArray *va_lines, *va_triangles;
// Returns all type of element in the GEntity
virtual void getTypeOfElements(std::vector<int> &)const { throw; }
virtual void addThisTypeOfElement(int type,std::vector<int> &groups);
}; };
class GEntityLessThan { class GEntityLessThan {
......
// $Id: GFace.cpp,v 1.53 2008-02-21 12:11:12 geuzaine Exp $ // $Id: GFace.cpp,v 1.54 2008-02-22 17:58:12 miegroet Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -718,3 +718,19 @@ double GFace::length(const SPoint2 &pt1, const SPoint2 &pt2, int nbQuadPoints) ...@@ -718,3 +718,19 @@ double GFace::length(const SPoint2 &pt1, const SPoint2 &pt2, int nbQuadPoints)
return L; return L;
#endif #endif
} }
void GFace::getTypeOfElements(std::vector<int> &groups)
{
for(unsigned int j = 0; j < triangles.size(); j++)
{
int type = triangles[j]->getTypeForMSH();
addThisTypeOfElement(type,groups);
}
for(unsigned int j = 0; j < quadrangles.size(); j++)
{
int type = quadrangles[j]->getTypeForMSH();
addThisTypeOfElement(type,groups);
}
}
...@@ -206,6 +206,9 @@ class GFace : public GEntity ...@@ -206,6 +206,9 @@ class GFace : public GEntity
std::vector<MTriangle*> triangles; std::vector<MTriangle*> triangles;
std::vector<MQuadrangle*> quadrangles; std::vector<MQuadrangle*> quadrangles;
// Returns each type of element in the gentity
void getTypeOfElements(std::vector<int> &groups);
}; };
#endif #endif
// $Id: GModel.cpp,v 1.62 2008-02-22 07:49:38 geuzaine Exp $ // $Id: GModel.cpp,v 1.63 2008-02-22 17:58:12 miegroet Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -720,3 +720,51 @@ void GModel::checkMeshCoherence() ...@@ -720,3 +720,51 @@ void GModel::checkMeshCoherence()
MElementLessThanLexicographic::tolerance = old_tol; MElementLessThanLexicographic::tolerance = old_tol;
} }
} }
//maybe UseLess as we can get each vector directly through the GEntities
void GModel::getTypeOfElements(std::map<GEntity*, std::vector<int> > groups[3])
{
//for(viter it = firstVertex(); it != lastVertex(); ++it)
// (*it)->getTypeOfElements(groups[0][(*it)]);
for(eiter it = firstEdge(); it != lastEdge(); ++it)
(*it)->getTypeOfElements(groups[0][(*it)]);
for(fiter it = firstFace(); it != lastFace(); ++it)
(*it)->getTypeOfElements(groups[1][(*it)]);
for(riter it = firstRegion(); it != lastRegion(); ++it)
(*it)->getTypeOfElements(groups[2][(*it)]);
}
void GModel::getTypeOfElements(std::map<int, std::vector<int> > groups[3])
{
//for(unsigned int i=0;i<(*it)->physicals.size();i++)
// (*it)->getTypeOfElements(groups[0][i]);
for(eiter it = firstEdge(); it != lastEdge(); ++it){
if((*it)->physicals.size()){
(*it)->getTypeOfElements(groups[0][(*it)->physicals[0]]);
for(unsigned int i=1;i<(*it)->physicals.size();i++)
groups[0][(*it)->physicals[i]]=groups[0][(*it)->physicals[i-1]];
}
}
for(fiter it = firstFace(); it != lastFace(); ++it){
if((*it)->physicals.size()){
(*it)->getTypeOfElements(groups[1][(*it)->physicals[0]]);
for(unsigned int i=1;i<(*it)->physicals.size();i++)
groups[1][(*it)->physicals[i]]=groups[1][(*it)->physicals[i-1]];
}
}
for(riter it = firstRegion(); it != lastRegion(); ++it){
if((*it)->physicals.size()){
(*it)->getTypeOfElements(groups[2][(*it)->physicals[0]]);
for(unsigned int i=1;i<(*it)->physicals.size();i++)
groups[2][(*it)->physicals[i]]=groups[2][(*it)->physicals[i-1]];
}
}
}
...@@ -121,6 +121,12 @@ class GModel ...@@ -121,6 +121,12 @@ class GModel
// Returns all physical groups (one map per dimension: 0-D to 3-D) // Returns all physical groups (one map per dimension: 0-D to 3-D)
void getPhysicalGroups(std::map<int, std::vector<GEntity*> > groups[4]); void getPhysicalGroups(std::map<int, std::vector<GEntity*> > groups[4]);
// Returns all type of element in each GEntity (one map per dimension: 1-D to 3-D)
void getTypeOfElements(std::map<GEntity*, std::vector<int> > groups[3]);
// Returns all type of element in each physical group (one map per dimension: 1-D to 3-D)
void getTypeOfElements(std::map<int, std::vector<int> > groups[3]);
// Deletes physical groups in the model // Deletes physical groups in the model
void deletePhysicalGroups(); void deletePhysicalGroups();
void deletePhysicalGroup(int dim, int num); void deletePhysicalGroup(int dim, int num);
......
// $Id: GRegion.cpp,v 1.22 2008-02-17 08:47:58 geuzaine Exp $ // $Id: GRegion.cpp,v 1.23 2008-02-22 17:58:12 miegroet Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -177,3 +177,28 @@ bool GRegion::edgeConnected(GRegion *r) const ...@@ -177,3 +177,28 @@ bool GRegion::edgeConnected(GRegion *r) const
} }
return false; return false;
} }
void GRegion::getTypeOfElements(std::vector<int> &groups)
{
for(unsigned int i = 0; i < tetrahedra.size(); i++){
int type = tetrahedra[i]->getTypeForMSH();
addThisTypeOfElement(type,groups);
}
for(unsigned int i = 0; i < hexahedra.size(); i++){
int type = hexahedra[i]->getTypeForMSH();
addThisTypeOfElement(type,groups);
}
for(unsigned int i = 0; i < prisms.size(); i++){
int type = prisms[i]->getTypeForMSH();
addThisTypeOfElement(type,groups);
}
for(unsigned int i = 0; i < pyramids.size(); i++) {
int type = pyramids[i]->getTypeForMSH();
addThisTypeOfElement(type,groups);
}
}
\ No newline at end of file
...@@ -74,6 +74,10 @@ class GRegion : public GEntity { ...@@ -74,6 +74,10 @@ class GRegion : public GEntity {
// indices // indices
std::vector<std::vector<std::vector<MVertex*> > > transfinite_vertices; std::vector<std::vector<std::vector<MVertex*> > > transfinite_vertices;
// Returns each type of element in the gentity
void getTypeOfElements(std::vector<int> &groups);
std::vector<MTetrahedron*> tetrahedra; std::vector<MTetrahedron*> tetrahedra;
std::vector<MHexahedron*> hexahedra; std::vector<MHexahedron*> hexahedra;
std::vector<MPrism*> prisms; std::vector<MPrism*> prisms;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment