From 904af3701eb7b72b3ef5d1597772f4a07221fb92 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 21 Jan 2008 20:34:54 +0000 Subject: [PATCH] API cleanup: FVertex, FEdge, etc. -> fourierVertex, fourierEdge, etc. --- Fltk/GUI_Projection.cpp | 28 +++++------ Fltk/GUI_Projection.h | 8 ++-- Fltk/Makefile | 49 ++++++++++---------- Geo/GModel.h | 2 +- Geo/{GModelIO_F.cpp => GModelIO_Fourier.cpp} | 39 ++++++++-------- Geo/{GModelIO_F.h => GModelIO_Fourier.h} | 4 +- Geo/Makefile | 37 ++++++++------- Geo/{FEdge.cpp => fourierEdge.cpp} | 17 +++---- Geo/{FEdge.h => fourierEdge.h} | 12 ++--- Geo/{FFace.cpp => fourierFace.cpp} | 24 +++++----- Geo/{FFace.h => fourierFace.h} | 14 +++--- Geo/fourierProjectionFace.cpp | 48 +++++++++++++++++++ Geo/fourierProjectionFace.h | 31 +++++++++++++ Geo/{FVertex.h => fourierVertex.h} | 10 ++-- Geo/gmshVertex.cpp | 27 ++++++----- Parser/OpenFile.cpp | 4 +- 16 files changed, 218 insertions(+), 136 deletions(-) rename Geo/{GModelIO_F.cpp => GModelIO_Fourier.cpp} (73%) rename Geo/{GModelIO_F.h => GModelIO_Fourier.h} (68%) rename Geo/{FEdge.cpp => fourierEdge.cpp} (68%) rename Geo/{FEdge.h => fourierEdge.h} (74%) rename Geo/{FFace.cpp => fourierFace.cpp} (63%) rename Geo/{FFace.h => fourierFace.h} (69%) create mode 100644 Geo/fourierProjectionFace.cpp create mode 100644 Geo/fourierProjectionFace.h rename Geo/{FVertex.h => fourierVertex.h} (72%) diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp index f489812990..fce0b98319 100644 --- a/Fltk/GUI_Projection.cpp +++ b/Fltk/GUI_Projection.cpp @@ -1,4 +1,4 @@ -#include "GModelIO_F.h" +#include "GModelIO_Fourier.h" #include "MElement.h" #include "Draw.h" #include "Options.h" @@ -7,7 +7,7 @@ #include "SelectBuffer.h" #include "GUI_Projection.h" #include "GUI_Extras.h" -#include "FFace.h" +#include "fourierFace.h" #include "Message.h" extern Context_T CTX; @@ -22,21 +22,21 @@ extern Context_T CTX; #include "FM_RevolvedParabolaProjectionSurface.h" #include "FM_TranslatedParabolaProjectionSurface.h" -static FProjectionFace *createProjectionFaceFromName(char *name) +static fourierProjectionFace *createProjectionFaceFromName(char *name) { GModel *m = GModel::current(); int tag = m->numFace() + 1; - FProjectionFace *f = 0; + fourierProjectionFace *f = 0; if(!strcmp(name, "plane")) - f = new FProjectionFace(m, tag, new FM::PlaneProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, new FM::PlaneProjectionSurface(tag)); else if(!strcmp(name, "paraboloid")) - f = new FProjectionFace(m, tag, new FM::ParaboloidProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, new FM::ParaboloidProjectionSurface(tag)); else if(!strcmp(name, "cylinder")) - f = new FProjectionFace(m, tag, new FM::CylindricalProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, new FM::CylindricalProjectionSurface(tag)); else if(!strcmp(name, "revolvedParabola")) - f = new FProjectionFace(m, tag, new FM::RevolvedParabolaProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, new FM::RevolvedParabolaProjectionSurface(tag)); else if(!strcmp(name, "translatedParabola")) - f = new FProjectionFace(m, tag, new FM::TranslatedParabolaProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, new FM::TranslatedParabolaProjectionSurface(tag)); else Msg(GERROR, "Unknown projection face `%s'", name); if(f){ @@ -127,8 +127,8 @@ void uvPlot::draw() fl_draw(max, pw - (int)fl_width(max) - 5, h() - 5); } -projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, int BH, - projectionEditor *e) +projection::projection(fourierProjectionFace *f, int x, int y, int w, int h, + int BB, int BH, projectionEditor *e) : face(f) { group = new Fl_Scroll(x, y, w, h); @@ -384,7 +384,7 @@ projectionEditor::projectionEditor() _window->size_range(width, (int)(0.85 * height)); } -void projectionEditor::load(FProjectionFace *face, std::string tag) +void projectionEditor::load(fourierProjectionFace *face, std::string tag) { FM::ProjectionSurface *ps = (FM::ProjectionSurface*)face->getNativePtr(); _browser->add(tag.size() ? tag.c_str() : ps->GetName().c_str()); @@ -848,7 +848,7 @@ void load_projection_cb(Fl_Widget *w, void *data) Msg(GERROR, "Bad projection file format"); return; } - FProjectionFace *face = createProjectionFaceFromName(name); + fourierProjectionFace *face = createProjectionFaceFromName(name); if(face){ e->load(face, tag); projection *p = e->getLastProjection(); @@ -1030,7 +1030,7 @@ void action_cb(Fl_Widget *w, void *data) } fprintf(fp, "%d\n", (int)faces.size()); for(unsigned int i = 0; i < faces.size(); i++){ - FFace* ff = (FFace*)faces[i]; + fourierFace* ff = (fourierFace*)faces[i]; ((FM::TopoFace*)ff->getNativePtr())->GetPatch()->Export(fp); } fclose(fp); diff --git a/Fltk/GUI_Projection.h b/Fltk/GUI_Projection.h index 29d80e5278..1d78405ba8 100644 --- a/Fltk/GUI_Projection.h +++ b/Fltk/GUI_Projection.h @@ -3,7 +3,7 @@ #include "GmshUI.h" #include "GModel.h" -#include "FProjectionFace.h" +#include "fourierProjectionFace.h" #include "GUI.h" #include "Shortcut_Window.h" #include "ColorTable.h" @@ -55,10 +55,10 @@ class projectionEditor; class projection { public: - FProjectionFace *face; + fourierProjectionFace *face; Fl_Group *group; std::vector<Fl_Value_Input*> parameters; - projection(FProjectionFace *f, int x, int y, int w, int h, int BB, int BH, + projection(fourierProjectionFace *f, int x, int y, int w, int h, int BB, int BH, projectionEditor *e); }; @@ -77,7 +77,7 @@ class projectionEditor { Fl_Slider *_slider; public: projectionEditor(); - void load(FProjectionFace *face, std::string tag=""); + void load(fourierProjectionFace *face, std::string tag=""); void show(){ _window->show(); select_cb(0, this); } uvPlot *uv() { return _uvPlot; } std::vector<MElement*> &getElements() { return _elements; } diff --git a/Fltk/Makefile b/Fltk/Makefile index a1a054cd4a..d921884846 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.162 2008-01-21 19:22:50 geuzaine Exp $ +# $Id: Makefile,v 1.163 2008-01-21 20:34:54 geuzaine Exp $ # # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle # @@ -111,25 +111,26 @@ GUI_Extras.o: GUI_Extras.cpp ../Common/GmshUI.h ../Common/GmshDefines.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h GUI.h Opengl_Window.h \ Colorbar_Window.h Popup_Button.h SpherePosition_Widget.h \ Shortcut_Window.h File_Picker.h -GUI_Projection.o: GUI_Projection.cpp ../Geo/GModelIO_F.h ../Geo/GModel.h \ - ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ - ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \ - ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \ - ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \ - ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \ - ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \ - ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \ +GUI_Projection.o: GUI_Projection.cpp ../Geo/GModelIO_Fourier.h \ + ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \ + ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ + ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h \ + ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \ + ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h \ + ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h \ + ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \ ../Geo/MElement.h ../Common/GmshDefines.h ../Geo/MVertex.h \ ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \ ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Graphics/Draw.h \ ../Common/Options.h ../Post/ColorTable.h ../Common/Context.h \ ../DataStr/List.h ../Parser/OpenFile.h ../Graphics/SelectBuffer.h \ - GUI_Projection.h ../Common/GmshUI.h ../Geo/FProjectionFace.h \ + GUI_Projection.h ../Common/GmshUI.h ../Geo/fourierProjectionFace.h \ ../Geo/GModel.h ../Geo/Range.h GUI.h Opengl_Window.h Colorbar_Window.h \ Popup_Button.h SpherePosition_Widget.h Shortcut_Window.h GUI_Extras.h \ - ../Geo/FFace.h ../Geo/GFace.h ../Geo/GModel.h ../Geo/Range.h \ - ../Geo/FEdge.h ../Geo/GEdge.h ../Geo/GModel.h ../Geo/FVertex.h \ - ../Geo/GModel.h ../Geo/GVertex.h ../Geo/MVertex.h ../Common/Message.h + ../Geo/fourierFace.h ../Geo/GFace.h ../Geo/GModel.h ../Geo/Range.h \ + ../Geo/fourierEdge.h ../Geo/GEdge.h ../Geo/GModel.h \ + ../Geo/fourierVertex.h ../Geo/GModel.h ../Geo/GVertex.h \ + ../Geo/MVertex.h ../Common/Message.h GUI_Classifier.o: GUI_Classifier.cpp GUI_Classifier.h ../Common/GmshUI.h \ ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \ ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ @@ -144,17 +145,17 @@ GUI_Classifier.o: GUI_Classifier.cpp GUI_Classifier.h ../Common/GmshUI.h \ Colorbar_Window.h ../Post/ColorTable.h Popup_Button.h \ SpherePosition_Widget.h Shortcut_Window.h ../Graphics/Draw.h \ ../Common/Options.h ../Common/Context.h ../DataStr/List.h \ - ../Graphics/SelectBuffer.h GUI_Projection.h ../Geo/FProjectionFace.h \ - ../Geo/GModel.h ../Geo/Range.h GUI_Extras.h ../Common/Message.h \ - ../Mesh/meshGFaceDelaunayInsertion.h ../Mesh/meshGFaceOptimize.h \ - ../Mesh/meshGFaceDelaunayInsertion.h ../Geo/gmshEdge.h ../Geo/Geo.h \ - ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \ - ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \ - ../Numeric/Numeric.h ../DataStr/Tree.h ../DataStr/avl.h \ - ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \ - ../Geo/GEdge.h ../Geo/gmshVertex.h ../Geo/Geo.h ../Geo/GVertex.h \ - ../Geo/MVertex.h ../Geo/Range.h ../Geo/gmshFace.h ../Geo/Geo.h \ - ../Geo/GFace.h ../Geo/gmshVertex.h ../Geo/Range.h + ../Graphics/SelectBuffer.h GUI_Projection.h \ + ../Geo/fourierProjectionFace.h ../Geo/GModel.h ../Geo/Range.h \ + GUI_Extras.h ../Common/Message.h ../Mesh/meshGFaceDelaunayInsertion.h \ + ../Mesh/meshGFaceOptimize.h ../Mesh/meshGFaceDelaunayInsertion.h \ + ../Geo/gmshEdge.h ../Geo/Geo.h ../Geo/gmshSurface.h ../Geo/Pair.h \ + ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \ + ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h ../DataStr/Tree.h \ + ../DataStr/avl.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \ + ../Common/SmoothData.h ../Geo/GEdge.h ../Geo/gmshVertex.h ../Geo/Geo.h \ + ../Geo/GVertex.h ../Geo/MVertex.h ../Geo/Range.h ../Geo/gmshFace.h \ + ../Geo/Geo.h ../Geo/GFace.h ../Geo/gmshVertex.h ../Geo/Range.h Callbacks.o: Callbacks.cpp ../Common/GmshUI.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/Tools.h ../DataStr/List.h \ ../DataStr/Tree.h ../DataStr/avl.h ../Geo/GModel.h ../Geo/GVertex.h \ diff --git a/Geo/GModel.h b/Geo/GModel.h index d28ecff11b..921fb4eeaa 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -179,7 +179,7 @@ class GModel int writeGEO(const std::string &name, bool printLabels=true); // Fourier model - int readF(const std::string &name); + int readFourier(const std::string &name); // OCC model int readOCCBREP(const std::string &name); diff --git a/Geo/GModelIO_F.cpp b/Geo/GModelIO_Fourier.cpp similarity index 73% rename from Geo/GModelIO_F.cpp rename to Geo/GModelIO_Fourier.cpp index b565415787..61606d9a38 100644 --- a/Geo/GModelIO_F.cpp +++ b/Geo/GModelIO_Fourier.cpp @@ -1,10 +1,10 @@ #include <string> #include "GModel.h" #include "Message.h" -#include "FVertex.h" -#include "FEdge.h" -#include "FFace.h" -#include "GModelIO_F.h" +#include "fourierVertex.h" +#include "fourierEdge.h" +#include "fourierFace.h" +#include "GModelIO_Fourier.h" #if defined(HAVE_FOURIER_MODEL) @@ -31,16 +31,16 @@ void makeGFace(FM::Patch* patch) int tagVertex = m->numVertex(); patch->F(LL[0], LL[1], xx, yy, zz); FM::TopoVertex* vLL = new FM::TopoVertex(++tagVertex, xx, yy, zz); - m->add(new FVertex(m, vLL->GetTag(), vLL)); + m->add(new fourierVertex(m, vLL->GetTag(), vLL)); patch->F(LR[0], LR[1], xx, yy, zz); FM::TopoVertex* vLR = new FM::TopoVertex(++tagVertex, xx, yy, zz); - m->add(new FVertex(m, vLR->GetTag(), vLR)); + m->add(new fourierVertex(m, vLR->GetTag(), vLR)); patch->F(UL[0], UL[1], xx, yy, zz); FM::TopoVertex* vUL = new FM::TopoVertex(++tagVertex, xx, yy, zz); - m->add(new FVertex(m, vUL->GetTag(), vUL)); + m->add(new fourierVertex(m, vUL->GetTag(), vUL)); patch->F(UR[0], UR[1], xx, yy, zz); FM::TopoVertex* vUR = new FM::TopoVertex(++tagVertex, xx, yy, zz); - m->add(new FVertex(m, vUR->GetTag(), vUR)); + m->add(new fourierVertex(m, vUR->GetTag(), vUR)); FM::Curve* curveB = new FM::FCurve(0, patch, LL, LR); FM::Curve* curveR = new FM::FCurve(0, patch, LR, UR); @@ -51,23 +51,23 @@ void makeGFace(FM::Patch* patch) FM::TopoEdge* eB = new FM::TopoEdge(++tagEdge, curveB, vLL, vLR); i1 = eB->GetStartPoint()->GetTag(); i2 = eB->GetEndPoint()->GetTag(); - m->add(new FEdge(m, eB, eB->GetTag(), m->vertexByTag(i1), - m->vertexByTag(i2))); + m->add(new fourierEdge(m, eB, eB->GetTag(), m->vertexByTag(i1), + m->vertexByTag(i2))); FM::TopoEdge* eR = new FM::TopoEdge(++tagEdge, curveR, vLR, vUR); i1 = eR->GetStartPoint()->GetTag(); i2 = eR->GetEndPoint()->GetTag(); - m->add(new FEdge(m, eR, eR->GetTag(), m->vertexByTag(i1), - m->vertexByTag(i2))); + m->add(new fourierEdge(m, eR, eR->GetTag(), m->vertexByTag(i1), + m->vertexByTag(i2))); FM::TopoEdge* eT = new FM::TopoEdge(++tagEdge, curveT, vUR, vUL); i1 = eT->GetStartPoint()->GetTag(); i2 = eT->GetEndPoint()->GetTag(); - m->add(new FEdge(m, eT, eT->GetTag(), m->vertexByTag(i1), - m->vertexByTag(i2))); + m->add(new fourierEdge(m, eT, eT->GetTag(), m->vertexByTag(i1), + m->vertexByTag(i2))); FM::TopoEdge* eL = new FM::TopoEdge(++tagEdge, curveL, vUL, vLL); i1 = eL->GetStartPoint()->GetTag(); i2 = eL->GetEndPoint()->GetTag(); - m->add(new FEdge(m, eL, eL->GetTag(), m->vertexByTag(i1), - m->vertexByTag(i2))); + m->add(new fourierEdge(m, eL, eL->GetTag(), m->vertexByTag(i1), + m->vertexByTag(i2))); FM::TopoFace* face = new FM::TopoFace(m->numFace() + 1, patch); face->AddEdge(eB); face->AddEdge(eR); @@ -77,21 +77,20 @@ void makeGFace(FM::Patch* patch) int tag = face->GetEdge(j)->GetTag(); l_edges.push_back(m->edgeByTag(tag)); } - m->add(new FFace(m, face, face->GetTag(), l_edges)); + m->add(new fourierFace(m, face, face->GetTag(), l_edges)); } -int GModel::readF(const std::string &filename) +int GModel::readFourier(const std::string &filename) { FM::Reader* reader = new FM::Reader(filename.c_str()); for (int i = 0; i < reader->GetNumPatches(); i++) makeGFace(reader->GetPatch(i)); - return 1; } #else -int GModel::readF(const std::string &fn) +int GModel::readFourier(const std::string &fn) { Msg(GERROR, "Gmsh has to be compiled with Fourier Model support to load '%s'", fn.c_str()); diff --git a/Geo/GModelIO_F.h b/Geo/GModelIO_Fourier.h similarity index 68% rename from Geo/GModelIO_F.h rename to Geo/GModelIO_Fourier.h index 38b011aeda..a66848c7bd 100644 --- a/Geo/GModelIO_F.h +++ b/Geo/GModelIO_Fourier.h @@ -1,5 +1,5 @@ -#ifndef _GMODELIO_F_H_ -#define _GMODELIO_F_H_ +#ifndef _GMODEL_IO_FOURIER_H_ +#define _GMODEL_IO_FOURIER_H_ #include "GModel.h" diff --git a/Geo/Makefile b/Geo/Makefile index 0faadefcda..fe139b89b3 100644 --- a/Geo/Makefile +++ b/Geo/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.176 2008-01-21 19:22:50 geuzaine Exp $ +# $Id: Makefile,v 1.177 2008-01-21 20:34:54 geuzaine Exp $ # # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle # @@ -32,13 +32,12 @@ SRC = GEntity.cpp\ GVertex.cpp GEdge.cpp GEdgeLoop.cpp GFace.cpp GRegion.cpp\ gmshVertex.cpp gmshEdge.cpp gmshFace.cpp gmshRegion.cpp gmshSurface.cpp\ OCCVertex.cpp OCCEdge.cpp OCCFace.cpp OCCRegion.cpp\ - FEdge.cpp FFace.cpp\ - FProjectionFace.cpp\ + fourierEdge.cpp fourierFace.cpp fourierProjectionFace.cpp\ GModel.cpp\ GModelIO_Geo.cpp\ GModelIO_Mesh.cpp\ GModelIO_OCC.cpp\ - GModelIO_F.cpp\ + GModelIO_Fourier.cpp\ GModelIO_CGNS.cpp\ GModelIO_MED.cpp\ ExtrudeParams.cpp \ @@ -138,17 +137,18 @@ OCCRegion.o: OCCRegion.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \ SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h GFace.h \ GEdgeLoop.h Pair.h GRegion.h OCCVertex.h OCCIncludes.h MVertex.h \ OCCEdge.h OCCFace.h OCCRegion.h ../Common/Message.h -FEdge.o: FEdge.cpp FEdge.h GEdge.h GEntity.h Range.h SPoint3.h \ - SBoundingBox3d.h GVertex.h GPoint.h SPoint2.h SVector3.h GModel.h \ - GFace.h GEdgeLoop.h Pair.h GRegion.h FVertex.h MVertex.h \ +fourierEdge.o: fourierEdge.cpp fourierEdge.h GEdge.h GEntity.h Range.h \ + SPoint3.h SBoundingBox3d.h GVertex.h GPoint.h SPoint2.h SVector3.h \ + GModel.h GFace.h GEdgeLoop.h Pair.h GRegion.h fourierVertex.h MVertex.h \ ../Common/Context.h ../DataStr/List.h -FFace.o: FFace.cpp FVertex.h GModel.h GVertex.h GEntity.h Range.h \ - SPoint3.h SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h \ - GFace.h GEdgeLoop.h Pair.h GRegion.h MVertex.h FFace.h FEdge.h \ - ../Common/Message.h -FProjectionFace.o: FProjectionFace.cpp FProjectionFace.h GModel.h \ - GVertex.h GEntity.h Range.h SPoint3.h SBoundingBox3d.h GPoint.h \ - SPoint2.h GEdge.h SVector3.h GFace.h GEdgeLoop.h Pair.h GRegion.h +fourierFace.o: fourierFace.cpp fourierVertex.h GModel.h GVertex.h \ + GEntity.h Range.h SPoint3.h SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h \ + SVector3.h GFace.h GEdgeLoop.h Pair.h GRegion.h MVertex.h fourierFace.h \ + fourierEdge.h ../Common/Message.h +fourierProjectionFace.o: fourierProjectionFace.cpp \ + fourierProjectionFace.h GModel.h GVertex.h GEntity.h Range.h SPoint3.h \ + SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h GFace.h \ + GEdgeLoop.h Pair.h GRegion.h GModel.o: GModel.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \ SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h GFace.h \ GEdgeLoop.h Pair.h GRegion.h gmshSurface.h ../Numeric/Numeric.h \ @@ -180,10 +180,11 @@ GModelIO_OCC.o: GModelIO_OCC.cpp GModelIO_OCC.h GModel.h GVertex.h \ SVector3.h GFace.h GEdgeLoop.h Pair.h GRegion.h OCCIncludes.h \ ../Common/Message.h ../Common/Context.h ../DataStr/List.h OCCVertex.h \ MVertex.h OCCEdge.h OCCFace.h OCCRegion.h -GModelIO_F.o: GModelIO_F.cpp GModel.h GVertex.h GEntity.h Range.h \ - SPoint3.h SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h \ - GFace.h GEdgeLoop.h Pair.h GRegion.h ../Common/Message.h FVertex.h \ - MVertex.h FEdge.h FFace.h GModelIO_F.h +GModelIO_Fourier.o: GModelIO_Fourier.cpp GModel.h GVertex.h GEntity.h \ + Range.h SPoint3.h SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h \ + SVector3.h GFace.h GEdgeLoop.h Pair.h GRegion.h ../Common/Message.h \ + fourierVertex.h MVertex.h fourierEdge.h fourierFace.h \ + GModelIO_Fourier.h GModelIO_CGNS.o: GModelIO_CGNS.cpp GModel.h GVertex.h GEntity.h Range.h \ SPoint3.h SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h \ GFace.h GEdgeLoop.h Pair.h GRegion.h ../Common/Message.h MElement.h \ diff --git a/Geo/FEdge.cpp b/Geo/fourierEdge.cpp similarity index 68% rename from Geo/FEdge.cpp rename to Geo/fourierEdge.cpp index c5723cfe59..5b18e2f752 100644 --- a/Geo/FEdge.cpp +++ b/Geo/fourierEdge.cpp @@ -1,11 +1,12 @@ -#include "FEdge.h" +#include "fourierEdge.h" #include "Context.h" extern Context_T CTX; #if defined(HAVE_FOURIER_MODEL) -FEdge::FEdge(GModel *model, FM::TopoEdge* edge_, int tag, GVertex *v0, GVertex *v1) +fourierEdge::fourierEdge(GModel *model, FM::TopoEdge* edge_, int tag, + GVertex *v0, GVertex *v1) : GEdge(model, tag, v0, v1), edge(edge_) { //meshAttributes.Method = TRANSFINI; @@ -13,33 +14,33 @@ FEdge::FEdge(GModel *model, FM::TopoEdge* edge_, int tag, GVertex *v0, GVertex * //meshAttributes.nbPointsTransfinite = 10; } -Range<double> FEdge::parBounds(int i) const +Range<double> fourierEdge::parBounds(int i) const { return(Range<double>(0.,1.)); } -GPoint FEdge::point(double p) const +GPoint fourierEdge::point(double p) const { double x, y, z; edge->F(p,x,y,z); return GPoint(x,y,z); } -double FEdge::parFromPoint(const SPoint3 &pt) const +double fourierEdge::parFromPoint(const SPoint3 &pt) const { double p; edge->Inverse(pt.x(),pt.y(),pt.z(),p); return p; } -SVector3 FEdge::firstDer(double par) const +SVector3 fourierEdge::firstDer(double par) const { double x,y,z; edge->Dfdt(par,x,y,z); return SVector3(x,y,z); } -int FEdge::minimumMeshSegments() const +int fourierEdge::minimumMeshSegments() const { if(geomType() == Line || geomType() == Unknown) return GEdge::minimumMeshSegments(); @@ -47,7 +48,7 @@ int FEdge::minimumMeshSegments() const return 2; // always put at least one mid-point on non-straight lines } -int FEdge::minimumDrawSegments() const +int fourierEdge::minimumDrawSegments() const { int n = GEdge::minimumDrawSegments(); diff --git a/Geo/FEdge.h b/Geo/fourierEdge.h similarity index 74% rename from Geo/FEdge.h rename to Geo/fourierEdge.h index d8f6ca6dcf..d95dddde8e 100644 --- a/Geo/FEdge.h +++ b/Geo/fourierEdge.h @@ -1,22 +1,22 @@ -#ifndef _F_EDGE_H_ -#define _F_EDGE_H_ +#ifndef _FOURIER_EDGE_H_ +#define _FOURIER_EDGE_H_ #include "GEdge.h" #include "GModel.h" -#include "FVertex.h" +#include "fourierVertex.h" #if defined(HAVE_FOURIER_MODEL) #include "FM_TopoEdge.h" #include "FM_TopoFace.h" -class FEdge : public GEdge { +class fourierEdge : public GEdge { protected: FM::TopoEdge *edge; int edgeNum; public: - FEdge(GModel *model, FM::TopoEdge *edge_, int tag, GVertex *v0, GVertex *v1); - virtual ~FEdge() {} + fourierEdge(GModel *model, FM::TopoEdge *edge_, int tag, GVertex *v0, GVertex *v1); + virtual ~fourierEdge() {} virtual Range<double> parBounds(int i) const; virtual GeomType geomType() const { return ParametricCurve; } virtual GPoint point(double p) const; diff --git a/Geo/FFace.cpp b/Geo/fourierFace.cpp similarity index 63% rename from Geo/FFace.cpp rename to Geo/fourierFace.cpp index 2ebb64312e..405baf18c2 100644 --- a/Geo/FFace.cpp +++ b/Geo/fourierFace.cpp @@ -1,11 +1,12 @@ #include <list> -#include "FVertex.h" -#include "FFace.h" +#include "fourierVertex.h" +#include "fourierFace.h" #include "Message.h" #if defined(HAVE_FOURIER_MODEL) -FFace::FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_) +fourierFace::fourierFace(GModel *m, FM::TopoFace *face_, int tag, + std::list<GEdge*> l_edges_) : GFace(m,tag), face(face_) { for (std::list<GEdge*>::iterator it = l_edges_.begin(); @@ -15,8 +16,9 @@ FFace::FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_ } } -FFace::FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_, - std::list<int> l_dirs_) : GFace(m,tag), face(face_) +fourierFace::fourierFace(GModel *m, FM::TopoFace *face_, int tag, + std::list<GEdge*> l_edges_, std::list<int> l_dirs_) + : GFace(m,tag), face(face_) { for (std::list<GEdge*>::iterator it = l_edges_.begin(); it != l_edges_.end(); it++) @@ -26,12 +28,12 @@ FFace::FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_ l_dirs.push_back((*it)); } -Range<double> FFace::parBounds(int i) const +Range<double> fourierFace::parBounds(int i) const { return Range<double>(0.,1.); } -GPoint FFace::point(double par1, double par2) const +GPoint fourierFace::point(double par1, double par2) const { double pp[2] = {par1,par2}; double x,y,z; @@ -39,7 +41,7 @@ GPoint FFace::point(double par1, double par2) const return GPoint(x, y, z, this, pp); } -SPoint2 FFace::parFromPoint(const SPoint3 &p) const +SPoint2 fourierFace::parFromPoint(const SPoint3 &p) const { double u, v, x, y, z; x = p.x(); y = p.y(); z = p.z(); @@ -48,7 +50,7 @@ SPoint2 FFace::parFromPoint(const SPoint3 &p) const return SPoint2(u, v); } -int FFace::containsParam(const SPoint2 &pt) const +int fourierFace::containsParam(const SPoint2 &pt) const { const double tol = 1.e-6; if(pt[0] < 0. - tol || pt[0] > 1. + tol) return 0; @@ -56,14 +58,14 @@ int FFace::containsParam(const SPoint2 &pt) const return 1; } -SVector3 FFace::normal(const SPoint2 ¶m) const +SVector3 fourierFace::normal(const SPoint2 ¶m) const { double x,y,z; face->GetUnitNormal(param[0],param[1],x,y,z); return SVector3(x, y, z); } -GEntity::GeomType FFace::geomType() const +GEntity::GeomType fourierFace::geomType() const { return GEntity::ParametricSurface; } diff --git a/Geo/FFace.h b/Geo/fourierFace.h similarity index 69% rename from Geo/FFace.h rename to Geo/fourierFace.h index 35195029f8..f4325b21b0 100644 --- a/Geo/FFace.h +++ b/Geo/fourierFace.h @@ -1,23 +1,23 @@ -#ifndef _F_FACE_H_ -#define _F_FACE_H_ +#ifndef _FOURIER_FACE_H_ +#define _FOURIER_FACE_H_ #include "GFace.h" #include "GModel.h" #include "Range.h" -#include "FEdge.h" +#include "fourierEdge.h" #if defined(HAVE_FOURIER_MODEL) #include "FM_TopoFace.h" -class FFace : public GFace { +class fourierFace : public GFace { protected: FM::TopoFace *face; public: - FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_); - FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_, + fourierFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_); + fourierFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_, std::list<int> l_dirs_); - virtual ~FFace() {} + virtual ~fourierFace() {} Range<double> parBounds(int i) const; virtual GPoint point(double par1, double par2) const; virtual SPoint2 parFromPoint(const SPoint3 &p) const; diff --git a/Geo/fourierProjectionFace.cpp b/Geo/fourierProjectionFace.cpp new file mode 100644 index 0000000000..70dc6f316e --- /dev/null +++ b/Geo/fourierProjectionFace.cpp @@ -0,0 +1,48 @@ +#include "fourierProjectionFace.h" + +#if defined(HAVE_FOURIER_MODEL) + +fourierProjectionFace::fourierProjectionFace(GModel *m, int num) + : GFace(m,num), ps_(0) {} + +fourierProjectionFace::fourierProjectionFace(GModel *m, int num, FM::ProjectionSurface* ps) + : GFace(m,num), ps_(ps) {} + +fourierProjectionFace::~fourierProjectionFace() {} + +GPoint fourierProjectionFace::point(double par1, double par2) const +{ + SVector3 p; + ps_->F(par1,par2,p[0],p[1],p[2]); + return GPoint(p[0],p[1],p[2]); +} + +SPoint2 fourierProjectionFace::parFromPoint(const SPoint3 &p) const +{ + double u,v; + ps_->Inverse(p[0],p[1],p[2],u,v); + return SPoint2(u,v); +} + +Pair<SVector3,SVector3> fourierProjectionFace::firstDer(const SPoint2 ¶m) const +{ + SVector3 du; + SVector3 dv; + ps_->Dfdu(param.x(),param.y(),du[0],du[1],du[2]); + ps_->Dfdv(param.x(),param.y(),dv[0],dv[1],dv[2]); + return Pair<SVector3,SVector3>(du,dv); +} + +SVector3 fourierProjectionFace::normal(const SPoint2 ¶m) const +{ + double x, y, z; + ps_->GetUnitNormal(param.x(),param.y(),x,y,z); + return SVector3(x,y,z); +} + +Range<double> fourierProjectionFace::parBounds(int i) const +{ + return Range<double>(0, 1); +} + +#endif diff --git a/Geo/fourierProjectionFace.h b/Geo/fourierProjectionFace.h new file mode 100644 index 0000000000..7313aa1ea6 --- /dev/null +++ b/Geo/fourierProjectionFace.h @@ -0,0 +1,31 @@ +#ifndef _FOURIER_PROJECTION_FACE_H_ +#define _FOURIER_PROJECTION_FACE_H_ + +#include "GModel.h" +#include "Range.h" + +#if defined(HAVE_FOURIER_MODEL) + +#include "FM_ProjectionSurface.h" + +class fourierProjectionFace : public GFace { + protected: + FM::ProjectionSurface *ps_; + public: + fourierProjectionFace(GModel *m, int num); + fourierProjectionFace(GModel *m, int num, FM::ProjectionSurface* ps); + ~fourierProjectionFace(); + Range<double> parBounds(int i) const; + GPoint point(double par1, double par2) const; + SVector3 normal(const SPoint2 ¶m) const; + Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; + SPoint2 parFromPoint(const SPoint3 &) const; + virtual int containsParam(const SPoint2 &pt) const { throw; } + virtual GEntity::GeomType geomType() const { return GEntity::ProjectionFace; } + ModelType getNativeType() const { return UnknownModel; } + void *getNativePtr() const { return ps_; } +}; + +#endif + +#endif diff --git a/Geo/FVertex.h b/Geo/fourierVertex.h similarity index 72% rename from Geo/FVertex.h rename to Geo/fourierVertex.h index b509048b40..64f3c9bdc4 100644 --- a/Geo/FVertex.h +++ b/Geo/fourierVertex.h @@ -1,5 +1,5 @@ -#ifndef _F_VERTEX_H_ -#define _F_VERTEX_H_ +#ifndef _FOURIER_VERTEX_H_ +#define _FOURIER_VERTEX_H_ #include "GModel.h" #include "GVertex.h" @@ -9,15 +9,15 @@ #include "FM_TopoVertex.h" -class FVertex : public GVertex { +class fourierVertex : public GVertex { protected: FM::TopoVertex *v; public: - FVertex(GModel *m, int num, FM::TopoVertex* _v) : GVertex(m, num), v(_v) + fourierVertex(GModel *m, int num, FM::TopoVertex* _v) : GVertex(m, num), v(_v) { mesh_vertices.push_back(new MVertex(x(), y(), z(), this)); } - virtual ~FVertex() {} + virtual ~fourierVertex() {} virtual GPoint point() const { return GPoint(x(),y(),z()); } virtual double x() const { return v->GetX(); } virtual double y() const { return v->GetY(); } diff --git a/Geo/gmshVertex.cpp b/Geo/gmshVertex.cpp index 8d5e7f59df..4c57ed3607 100644 --- a/Geo/gmshVertex.cpp +++ b/Geo/gmshVertex.cpp @@ -8,20 +8,19 @@ SPoint2 gmshVertex::reparamOnFace(GFace *face, int dir) const { - Surface *s = (Surface*) face->getNativePtr(); - if (s->geometry) - { - // It is not always right if it is periodic. - if (l_edges.size() == 1 && - (*l_edges.begin())->getBeginVertex() == - (*l_edges.begin())->getEndVertex() ) - { - Range<double> bb = (*l_edges.begin())->parBounds(0); - return (*l_edges.begin())->reparamOnFace ( face, bb.low(), dir); - } - return v -> pntOnGeometry; - } - if (s->Typ == MSH_SURF_REGL){ + Surface *s = (Surface*)face->getNativePtr(); + + if(s->geometry){ + // It is not always right if it is periodic. + if (l_edges.size() == 1 && + (*l_edges.begin())->getBeginVertex() == (*l_edges.begin())->getEndVertex()){ + Range<double> bb = (*l_edges.begin())->parBounds(0); + return (*l_edges.begin())->reparamOnFace ( face, bb.low(), dir); + } + return v -> pntOnGeometry; + } + + if(s->Typ == MSH_SURF_REGL){ Curve *C[4]; for(int i = 0; i < 4; i++) List_Read(s->Generatrices, i, &C[i]); diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index f6817e4c68..db41842e35 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.168 2008-01-20 10:10:45 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.169 2008-01-21 20:34:54 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -350,7 +350,7 @@ int MergeFile(const char *name, int warn_if_missing) status = m->readP3D(name); } else if(!strcmp(ext, ".fm") || !strcmp(ext, ".FM")) { - status = m->readF(name); + status = m->readFourier(name); } #if defined(HAVE_FLTK) else if(!strcmp(ext, ".pnm") || !strcmp(ext, ".PNM") || -- GitLab