From a44c87e3b21a910cd02761f3c5a8204b248f4a4c Mon Sep 17 00:00:00 2001 From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be> Date: Wed, 15 Nov 2006 14:36:39 +0000 Subject: [PATCH] OCC regions added --- Geo/OCCRegion.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++ Geo/OCCRegion.h | 37 +++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 Geo/OCCRegion.cpp create mode 100644 Geo/OCCRegion.h diff --git a/Geo/OCCRegion.cpp b/Geo/OCCRegion.cpp new file mode 100644 index 0000000000..bfaa45a2c1 --- /dev/null +++ b/Geo/OCCRegion.cpp @@ -0,0 +1,56 @@ +// $Id: OCCRegion.cpp,v 1.1 2006-11-15 14:36:39 remacle Exp $ +// +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <OCC@geuz.org>. + +#ifdef _HAVE_OCC_ +#include "GModel.h" +#include "OCCVertex.h" +#include "OCCEdge.h" +#include "OCCFace.h" +#include "OCCRegion.h" +#include "Message.h" + +OCCRegion::OCCRegion(GModel *m, TopoDS_Solid _s, int num, TopTools_IndexedMapOfShape &fmap) + : GRegion(m, num), s(_s) +{ + TopExp_Explorer exp0, exp01, exp1, exp2, exp3; + for (exp2.Init (s, TopAbs_SHELL); exp2.More(); exp2.Next()) + { + TopoDS_Shape shell = exp2.Current(); + Msg(INFO,"OCC Region %d - New Shell",num); + for (exp3.Init (shell, TopAbs_FACE); exp3.More(); exp3.Next()) + { + TopoDS_Face face = TopoDS::Face (exp3.Current()); + int index = fmap.FindIndex(face); + GFace *f = m->faceByTag(index); + if(!f) throw; + l_faces.push_back(f); + f->addRegion(this); + } + } + Msg(INFO,"OCC Region %d with %d edges",num,l_faces.size()); +} + +GEntity::GeomType OCCRegion::geomType() const +{ + return Unknown; +} + +#endif diff --git a/Geo/OCCRegion.h b/Geo/OCCRegion.h new file mode 100644 index 0000000000..bc78584f67 --- /dev/null +++ b/Geo/OCCRegion.h @@ -0,0 +1,37 @@ +#ifndef _OCC_REGION_H_ +#define _OCC_REGION_H_ + +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <gmsh@geuz.org>. + +#include "Mesh.h" +#include "GRegion.h" + +class OCCRegion : public GRegion { + protected: + TopoDS_Solid s; + public: + OCCRegion(GModel *m, TopoDS_Solid s , int num, TopTools_IndexedMapOfShape &fmap); + virtual ~OCCRegion() {} + virtual GeomType geomType() const; + ModelType getNativeType() const { return OpenCascadeModel; } + void * getNativePtr() const { return (void*)&s; } +}; + +#endif -- GitLab