Skip to content
Snippets Groups Projects
Commit af50a1c6 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

*** empty log message ***

parent dd2228bb
No related branches found
No related tags found
No related merge requests found
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
//
// Contributor(s):
// Emilie Marchandise
//
#include <stdlib.h>
#include "GmshConfig.h"
#include "GRegionCompound.h"
#include "Numeric.h"
GRegionCompound::GRegionCompound(GModel *m, int tag, std::vector<GRegion*> &compound)
: GRegion(m, tag), _compound(compound)
{
printf("********* In GRegion compound size =%d \n", _compound.size());
getBoundingFaces();
}
GRegionCompound::~GRegionCompound()
{
}
void GRegionCompound::getBoundingFaces(){
std::set<GFace*> _unique;
std::multiset<GFace*> _touched;
std::vector<GRegion*>::iterator it = _compound.begin();
for ( ; it != _compound.end(); ++it){
printf("face %d \n", (*it)->tag());
std::list<GFace*> ed = (*it)->faces();
std::list<GFace*> :: iterator ite = ed.begin();
for ( ; ite != ed.end(); ++ite){
_touched.insert(*ite);
}
}
it = _compound.begin();
for ( ; it != _compound.end(); ++it){
std::list<GFace*> ed = (*it)->faces();
std::list<GFace*> :: iterator ite = ed.begin();
for ( ; ite != ed.end() ; ++ite){
if (!(*ite)->degenerate(0) && _touched.count(*ite) == 1) {
_unique.insert(*ite); }
}
}
std::set<GFace*>::iterator itf = _unique.begin();
for ( ; itf != _unique.end(); ++itf){
l_faces.push_back(*itf);
printf("for face %d, add region %d \n", (*itf)->tag(), this->tag());
(*itf)->addRegion(this);
}
}
SBoundingBox3d GRegionCompound::bounds() const {
Msg::Error("Cannot evaluate bounds on GRegion Compound");
return SBoundingBox3d(SPoint3());
}
double GRegionCompound::curvature(double par) const
{
double k = 0.0;
Msg::Error("Cannot evaluate curvature on GRegionCompound");
return k;
}
GPoint GRegionCompound::point(double par) const
{
Msg::Error("Cannot evaluate point on GRegionCompound");
return GPoint();
}
SVector3 GRegionCompound::firstDer(double par) const
{
Msg::Error("Cannot evaluate firstDeriv on GRegionCompound");
return SVector3();
}
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#ifndef _GREGION_COMPOUND_H_
#define _GREGION_COMPOUND_H_
#include <list>
#include <map>
#include "GRegion.h"
#include "GFace.h"
#include "GFaceCompound.h"
/*
A GRegionCompound is a model region that is the compound of model regions.
It is assumed that all the regions of the compound have been meshed
first and that all the faces of the compound region are compound surfaces.
The compound can therefore be re-meshed using any surface mesh
generator of gmsh!
*/
class GRegionCompound : public GRegion {
public:
GRegionCompound(GModel *m, int tag, std::vector<GRegion*> &compound);
virtual ~GRegionCompound();
virtual SBoundingBox3d bounds() const;
virtual double curvature(double t) const;
virtual GPoint point(double par) const;
virtual SVector3 firstDer(double par) const;
virtual GEntity::GeomType geomType() const { return CompoundVolume; }
ModelType getNativeType() const { return GmshModel; }
void * getNativePtr() const { return 0; }
protected:
std::vector<GRegion*> _compound;
void getBoundingFaces();
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment