From 08cecd83a28b8537cdb702db37ce0b93b4c8c327 Mon Sep 17 00:00:00 2001 From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be> Date: Mon, 6 Oct 2008 10:04:31 +0000 Subject: [PATCH] rewrite the LongitudeLatitude plugin to work with high order elements --- Plugin/LongitudeLatitude.cpp | 121 +++++++++ ...{TransformLatLon.h => LongitudeLatitude.h} | 9 +- Plugin/Makefile | 156 +++++++----- Plugin/PluginManager.cpp | 4 +- Plugin/TransformLatLon.cpp | 237 ------------------ 5 files changed, 220 insertions(+), 307 deletions(-) create mode 100644 Plugin/LongitudeLatitude.cpp rename Plugin/{TransformLatLon.h => LongitudeLatitude.h} (70%) delete mode 100644 Plugin/TransformLatLon.cpp diff --git a/Plugin/LongitudeLatitude.cpp b/Plugin/LongitudeLatitude.cpp new file mode 100644 index 0000000000..17a1ea036e --- /dev/null +++ b/Plugin/LongitudeLatitude.cpp @@ -0,0 +1,121 @@ +// Gmsh - Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to <gmsh@geuz.org>. + +#include "LongitudeLatitude.h" + +StringXNumber LongituteLatitudeOptions_Number[] = { + {GMSH_FULLRC, "iView", NULL, -1.} +}; + +extern "C" +{ + GMSH_Plugin *GMSH_RegisterLongituteLatitudePlugin() + { + return new GMSH_LongituteLatitudePlugin(); + } +} + +void GMSH_LongituteLatitudePlugin::getName(char *name) const +{ + strcpy(name, "LongituteLatitude"); +} + +void GMSH_LongituteLatitudePlugin::getInfos(char *author, char *copyright, + char *help_text) const +{ + strcpy(author, "J. Lambrechts"); + strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); + strcpy(help_text, + "Plugin(LongituteLatitude) Project the view `iView'\n" + "in Longitude-Latitude. If `iView' < 0, the plugin\n" + "is run on the current view.\n" + "\n" + "Plugin(LongituteLatitude) is executed in place.\n"); +} + +int GMSH_LongituteLatitudePlugin::getNbOptions() const +{ + return sizeof(LongituteLatitudeOptions_Number) / sizeof(StringXNumber); +} + +StringXNumber *GMSH_LongituteLatitudePlugin::getOption(int iopt) +{ + return &LongituteLatitudeOptions_Number[iopt]; +} + +void GMSH_LongituteLatitudePlugin::catchErrorMessage(char *errorMessage) const +{ + strcpy(errorMessage, "LongituteLatitude failed..."); +} + +PView *GMSH_LongituteLatitudePlugin::execute(PView *v) +{ + int iView = (int)LongituteLatitudeOptions_Number[0].def; + + PView *v1 = getView(iView, v); + if(!v1) return v; + PViewData *data1 = v1->getData(); + + // tag all the nodes with "0" (the default tag) + for(int step = 0; step < data1->getNumTimeSteps(); step++){ + for(int ent = 0; ent < data1->getNumEntities(step); ent++){ + for(int ele = 0; ele < data1->getNumElements(step, ent); ele++){ + if(data1->skipElement(step, ent, ele)) continue; + for(int nod = 0; nod < data1->getNumNodes(step, ent, ele); nod++) + data1->tagNode(step, ent, ele, nod, 0); + } + } + } + // transform all "0" nodes + for(int step = 0; step < data1->getNumTimeSteps(); step++){ + for(int ent = 0; ent < data1->getNumEntities(step); ent++){ + for(int ele = 0; ele < data1->getNumElements(step, ent); ele++){ + if(data1->skipElement(step, ent, ele)) continue; + int nbComb=data1->getNumComponents(step,ent,ele); + double vin[3],vout[3]; + double xmin=M_PI,xmax=-M_PI; + for(int nod = 0; nod < data1->getNumNodes(step, ent, ele); nod++){ + double x, y, z; + int tag = data1->getNode(step, ent, ele, nod, x, y, z); + //if(!tag){ + double x2, y2, z2; + z2=sqrt(x*x+y*y+z*z); + y2=asin(z/z2); + x2=atan2(y,x); + xmin=std::min(x2,xmin); + xmax=std::max(x2,xmax); + data1->setNode(step, ent, ele, nod, x2*180/M_PI, y2*180/M_PI, z2); + data1->tagNode(step, ent, ele, nod, 1); + if(nbComb==3){ + for(int i=0;i<3;i++) + data1->getValue(step, ent, ele, nod, i, vin[i]); + vout[0] = -sin(x2) * vin[0] + cos(x2) * vin[1]; + vout[1] = + -sin(y2) * (cos(x2) * vin[0] + sin(x2) * vin[1]) + + cos(y2) * vin[2]; + vout[2] = + cos(y2) * (cos(x2) * vin[0] + sin(x2) * vin[1]) + + sin(y2) * vin[2]; + for(int i=0;i<3;i++) + data1->setValue(step, ent, ele, nod, i, vout[i]); + } + //} + } + if(xmax-xmin>M_PI){ // periodicity check (broken for continuous views) + for(int nod = 0; nod < data1->getNumNodes(step, ent, ele); nod++){ + double x,y,z; + data1->getNode(step, ent, ele, nod, x, y, z); + if(xmax*180/M_PI-x > 180) x+=360; + data1->setNode(step, ent, ele, nod, x, y, z); + } + } + } + } + } + + data1->finalize(); + v1->setChanged(true); + return v1; +} diff --git a/Plugin/TransformLatLon.h b/Plugin/LongitudeLatitude.h similarity index 70% rename from Plugin/TransformLatLon.h rename to Plugin/LongitudeLatitude.h index e531a47422..457b15a4e1 100644 --- a/Plugin/TransformLatLon.h +++ b/Plugin/LongitudeLatitude.h @@ -3,20 +3,19 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. -#ifndef _TRANSFORMLATLON_H_ -#define _TRANSFORMLATLON_H_ +#ifndef _LONGITUDELATITUDE_H_ +#define _LONGITUDELATITUDE_H_ #include "Plugin.h" extern "C" { - GMSH_Plugin *GMSH_RegisterTransformLatLonPlugin(); + GMSH_Plugin *GMSH_RegisterLongituteLatitudePlugin(); } -class GMSH_TransformLatLonPlugin : public GMSH_Post_Plugin +class GMSH_LongituteLatitudePlugin : public GMSH_Post_Plugin { public: - GMSH_TransformLatLonPlugin(); void getName(char *name) const; void getInfos(char *author, char *copyright, char *help_text) const; void catchErrorMessage(char *errorMessage) const; diff --git a/Plugin/Makefile b/Plugin/Makefile index 78fca96966..eb5512569f 100644 --- a/Plugin/Makefile +++ b/Plugin/Makefile @@ -22,7 +22,7 @@ SRC = Plugin.cpp PluginManager.cpp\ Eigenvectors.cpp Eigenvalues.cpp\ StreamLines.cpp CutGrid.cpp\ Transform.cpp\ - TransformLatLon.cpp\ + LongitudeLatitude.cpp\ Triangulate.cpp\ Warp.cpp SphericalRaise.cpp\ Skin.cpp GSHHS.cpp \ @@ -64,7 +64,10 @@ Plugin.o: Plugin.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \ ../Common/Message.h ../Post/PView.h ../Geo/SPoint3.h \ ../Post/PViewDataList.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \ ../Geo/SPoint3.h ../Common/ListUtils.h ../Common/GmshMatrix.h -PluginManager.o: PluginManager.cpp Plugin.h ../Common/Options.h \ +PluginManager.o: PluginManager.cpp /usr/include/fltk-1.1/FL/Fl.H \ + /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H \ + /usr/include/fltk-1.1/FL/filename.H Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ @@ -73,7 +76,7 @@ PluginManager.o: PluginManager.cpp Plugin.h ../Common/Options.h \ ../Common/TreeUtils.h ../Common/avl.h ../Common/ListUtils.h Extract.h \ ExtractElements.h ExtractEdges.h HarmonicToTime.h ModulusPhase.h \ Integrate.h Gradient.h Curl.h Divergence.h Annotate.h Remove.h \ - MakeSimplex.h Smooth.h Transform.h TransformLatLon.h Triangulate.h \ + MakeSimplex.h Smooth.h Transform.h LongitudeLatitude.h Triangulate.h \ Warp.h SphericalRaise.h Eigenvectors.h Eigenvalues.h Lambda2.h \ Evaluate.h ../Post/OctreePost.h ../Common/Octree.h \ ../Common/OctreeInternals.h Probe.h FieldView.h GSHHS.h \ @@ -90,6 +93,8 @@ CutPlane.o: CutPlane.cpp CutPlane.h Levelset.h Plugin.h \ ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ ../Common/ListUtils.h ../Common/GmshMatrix.h ../Common/Context.h \ ../Geo/CGNSOptions.h ../Mesh/PartitionOptions.h ../Common/GmshUI.h \ + /usr/include/fltk-1.1/FL/Fl.H /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H /usr/include/fltk-1.1/FL/gl.h \ ../Graphics/Draw.h CutSphere.o: CutSphere.cpp CutSphere.h Levelset.h Plugin.h \ ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \ @@ -97,6 +102,8 @@ CutSphere.o: CutSphere.cpp CutSphere.h Levelset.h Plugin.h \ ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ ../Common/ListUtils.h ../Common/GmshMatrix.h ../Common/Context.h \ ../Geo/CGNSOptions.h ../Mesh/PartitionOptions.h ../Common/GmshUI.h \ + /usr/include/fltk-1.1/FL/Fl.H /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H /usr/include/fltk-1.1/FL/gl.h \ ../Graphics/Draw.h CutMap.o: CutMap.cpp CutMap.h Levelset.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ @@ -116,7 +123,9 @@ CutParametric.o: CutParametric.cpp ../Post/OctreePost.h \ ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ ../Common/ListUtils.h ../Common/GmshMatrix.h ../Common/Context.h \ ../Geo/CGNSOptions.h ../Mesh/PartitionOptions.h ../Common/GmshUI.h \ - ../Graphics/Draw.h + /usr/include/fltk-1.1/FL/Fl.H /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H /usr/include/fltk-1.1/FL/gl.h \ + ../Graphics/Draw.h ../contrib/MathEval/matheval.h Lambda2.o: Lambda2.cpp Lambda2.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ @@ -142,37 +151,39 @@ StreamLines.o: StreamLines.cpp StreamLines.h Plugin.h ../Common/Options.h \ ../Common/GmshMatrix.h ../Post/OctreePost.h ../Common/Octree.h \ ../Common/OctreeInternals.h ../Common/Context.h ../Geo/CGNSOptions.h \ ../Mesh/PartitionOptions.h ../Post/PViewOptions.h ../Post/ColorTable.h \ - ../Common/GmshUI.h ../Graphics/Draw.h + ../Common/GmshUI.h /usr/include/fltk-1.1/FL/Fl.H \ + /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H /usr/include/fltk-1.1/FL/gl.h \ + ../Graphics/Draw.h CutGrid.o: CutGrid.cpp ../Post/OctreePost.h ../Common/Octree.h \ ../Common/OctreeInternals.h CutGrid.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ ../Common/GmshMatrix.h ../Common/Context.h ../Geo/CGNSOptions.h \ - ../Mesh/PartitionOptions.h ../Common/GmshUI.h ../Graphics/Draw.h + ../Mesh/PartitionOptions.h ../Common/GmshUI.h \ + /usr/include/fltk-1.1/FL/Fl.H /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H /usr/include/fltk-1.1/FL/gl.h \ + ../Graphics/Draw.h Transform.o: Transform.cpp Transform.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ ../Common/GmshMatrix.h -TransformLatLon.o: TransformLatLon.cpp TransformLatLon.h Plugin.h \ +LongitudeLatitude.o: LongitudeLatitude.cpp LongitudeLatitude.h Plugin.h \ ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \ ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \ ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ ../Common/ListUtils.h ../Common/GmshMatrix.h Triangulate.o: Triangulate.cpp ../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/SPoint3.h \ - ../Geo/SBoundingBox3d.h ../Geo/discreteFace.h ../Geo/GModel.h \ - ../Geo/GFace.h ../Mesh/DivideAndConquer.h ../Common/Message.h \ - ../Geo/MVertex.h ../Geo/SPoint3.h Triangulate.h Plugin.h \ - ../Common/Options.h ../Post/ColorTable.h ../Post/PView.h \ - ../Post/PViewDataList.h ../Post/PViewData.h ../Common/ListUtils.h \ + ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \ + ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GEdgeLoop.h ../Geo/Pair.h \ + ../Geo/GRegion.h ../Geo/discreteFace.h ../Geo/GModel.h \ + ../Mesh/DivideAndConquer.h ../Common/Message.h ../Geo/MVertex.h \ + Triangulate.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \ + ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \ + ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Common/ListUtils.h \ ../Common/GmshMatrix.h ../Common/Context.h ../Geo/CGNSOptions.h \ ../Mesh/PartitionOptions.h Warp.o: Warp.cpp Warp.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \ @@ -198,25 +209,15 @@ GSHHS.o: GSHHS.cpp GSHHS.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ - ../Common/GmshMatrix.h ../Mesh/Field.h ../Geo/Geo.h \ - ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \ - ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \ - ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/TreeUtils.h ../Common/avl.h \ - ../Common/ListUtils.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \ - ../Common/SmoothData.h ../Geo/GModel.h ../Geo/GVertex.h \ - ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ - ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \ - ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.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/SPoint3.h \ - ../Geo/SBoundingBox3d.h + ../Common/GmshMatrix.h ../Mesh/Field.h ../Geo/GModel.h ../Geo/GVertex.h \ + ../Geo/GEntity.h ../Geo/Range.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \ + ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/SVector3.h ../Geo/GFace.h \ + ../Geo/GEdgeLoop.h ../Geo/Pair.h ../Geo/GRegion.h Extract.o: Extract.cpp Extract.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ - ../Common/GmshMatrix.h + ../Common/GmshMatrix.h ../contrib/MathEval/matheval.h ExtractElements.o: ExtractElements.cpp ExtractElements.h Plugin.h \ ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \ ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \ @@ -228,12 +229,9 @@ ExtractEdges.o: ExtractEdges.cpp ExtractEdges.h Plugin.h \ ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \ ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ ../Common/ListUtils.h ../Common/GmshMatrix.h ../Mesh/BDS.h \ - ../Geo/GFace.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ - ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \ - ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/GEntity.h \ - ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/SPoint3.h \ - ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/SPoint2.h ../Geo/SVector3.h \ - ../Geo/Pair.h + ../Geo/GFace.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SBoundingBox3d.h \ + ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/GVertex.h \ + ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h MakeSimplex.o: MakeSimplex.cpp MakeSimplex.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ @@ -244,25 +242,15 @@ Evaluate.o: Evaluate.cpp Evaluate.h Plugin.h ../Common/Options.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ ../Common/GmshMatrix.h ../Post/OctreePost.h ../Common/Octree.h \ - ../Common/OctreeInternals.h + ../Common/OctreeInternals.h ../contrib/MathEval/matheval.h FieldView.o: FieldView.cpp FieldView.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ - ../Common/GmshMatrix.h ../Mesh/Field.h ../Geo/Geo.h \ - ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \ - ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \ - ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/TreeUtils.h ../Common/avl.h \ - ../Common/ListUtils.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \ - ../Common/SmoothData.h ../Geo/GModel.h ../Geo/GVertex.h \ - ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ - ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \ - ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.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/SPoint3.h \ - ../Geo/SBoundingBox3d.h + ../Common/GmshMatrix.h ../Mesh/Field.h ../Geo/GModel.h ../Geo/GVertex.h \ + ../Geo/GEntity.h ../Geo/Range.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \ + ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/SVector3.h ../Geo/GFace.h \ + ../Geo/GEdgeLoop.h ../Geo/Pair.h ../Geo/GRegion.h Integrate.o: Integrate.cpp Integrate.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ @@ -293,15 +281,54 @@ Annotate.o: Annotate.cpp Annotate.h Plugin.h ../Common/Options.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ ../Common/GmshMatrix.h ../Common/Context.h ../Geo/CGNSOptions.h \ - ../Mesh/PartitionOptions.h ../Common/GmshUI.h ../Fltk/GUI.h \ - ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \ + ../Mesh/PartitionOptions.h ../Common/GmshUI.h \ + /usr/include/fltk-1.1/FL/Fl.H /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H /usr/include/fltk-1.1/FL/gl.h \ + ../Fltk/GUI.h /usr/include/fltk-1.1/FL/Fl_Window.H \ + /usr/include/fltk-1.1/FL/Fl_Group.H \ + /usr/include/fltk-1.1/FL/Fl_Widget.H \ + /usr/include/fltk-1.1/FL/Fl_Double_Window.H \ + /usr/include/fltk-1.1/FL/Fl_Window.H /usr/include/fltk-1.1/FL/Fl_Box.H \ + /usr/include/fltk-1.1/FL/Fl_Menu_Bar.H \ + /usr/include/fltk-1.1/FL/Fl_Menu_.H \ + /usr/include/fltk-1.1/FL/Fl_Menu_Item.H \ + /usr/include/fltk-1.1/FL/Fl_Image.H \ + /usr/include/fltk-1.1/FL/Fl_Menu_Button.H \ + /usr/include/fltk-1.1/FL/fl_draw.H /usr/include/fltk-1.1/FL/Fl_Choice.H \ + /usr/include/fltk-1.1/FL/Fl_Scroll.H \ + /usr/include/fltk-1.1/FL/Fl_Scrollbar.H \ + /usr/include/fltk-1.1/FL/Fl_Slider.H \ + /usr/include/fltk-1.1/FL/Fl_Valuator.H \ + /usr/include/fltk-1.1/FL/Fl_Tabs.H /usr/include/fltk-1.1/FL/Fl_Button.H \ + /usr/include/fltk-1.1/FL/Fl_Return_Button.H \ + /usr/include/fltk-1.1/FL/Fl_Button.H \ + /usr/include/fltk-1.1/FL/Fl_Repeat_Button.H \ + /usr/include/fltk-1.1/FL/Fl.H \ + /usr/include/fltk-1.1/FL/Fl_Light_Button.H \ + /usr/include/fltk-1.1/FL/Fl_Check_Button.H \ + /usr/include/fltk-1.1/FL/Fl_Light_Button.H \ + /usr/include/fltk-1.1/FL/Fl_Input.H \ + /usr/include/fltk-1.1/FL/Fl_Input_.H \ + /usr/include/fltk-1.1/FL/Fl_Value_Input.H \ + /usr/include/fltk-1.1/FL/Fl_Input.H \ + /usr/include/fltk-1.1/FL/Fl_Output.H \ + /usr/include/fltk-1.1/FL/Fl_Multiline_Output.H \ + /usr/include/fltk-1.1/FL/Fl_Output.H \ + /usr/include/fltk-1.1/FL/Fl_Bitmap.H \ + /usr/include/fltk-1.1/FL/Fl_Browser.H \ + /usr/include/fltk-1.1/FL/Fl_Browser_.H \ + /usr/include/fltk-1.1/FL/Fl_Multi_Browser.H \ + /usr/include/fltk-1.1/FL/Fl_Browser.H \ + /usr/include/fltk-1.1/FL/Fl_Hold_Browser.H /usr/include/fltk-1.1/FL/x.H \ + /usr/include/fltk-1.1/FL/Fl_Color_Chooser.H \ + /usr/include/fltk-1.1/FL/Fl_Group.H /usr/include/fltk-1.1/FL/fl_ask.H \ + /usr/include/fltk-1.1/FL/Fl_Tooltip.H \ + /usr/include/fltk-1.1/FL/Fl_Widget.H \ + /usr/include/fltk-1.1/FL/Fl_Shared_Image.H \ + /usr/include/fltk-1.1/FL/Fl_File_Icon.H ../Fltk/Opengl_Window.h \ + /usr/include/fltk-1.1/FL/Fl_Gl_Window.H ../Fltk/Colorbar_Window.h \ ../Fltk/Popup_Button.h ../Fltk/SpherePosition_Widget.h ../Mesh/Field.h \ - ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \ - ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \ - ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/TreeUtils.h ../Common/avl.h \ - ../Common/ListUtils.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \ - ../Common/SmoothData.h ../Graphics/Draw.h + ../Graphics/Draw.h Remove.o: Remove.cpp Remove.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ @@ -313,7 +340,10 @@ Probe.o: Probe.cpp Probe.h Plugin.h ../Common/Options.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/ListUtils.h \ ../Common/GmshMatrix.h ../Common/Context.h ../Geo/CGNSOptions.h \ ../Mesh/PartitionOptions.h ../Post/OctreePost.h ../Common/Octree.h \ - ../Common/OctreeInternals.h ../Common/GmshUI.h ../Graphics/Draw.h + ../Common/OctreeInternals.h ../Common/GmshUI.h \ + /usr/include/fltk-1.1/FL/Fl.H /usr/include/fltk-1.1/FL/Enumerations.H \ + /usr/include/fltk-1.1/FL/Fl_Export.H /usr/include/fltk-1.1/FL/gl.h \ + ../Graphics/Draw.h HarmonicToTime.o: HarmonicToTime.cpp HarmonicToTime.h Plugin.h \ ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \ ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \ diff --git a/Plugin/PluginManager.cpp b/Plugin/PluginManager.cpp index e426d9e3d4..0d1dac9f08 100644 --- a/Plugin/PluginManager.cpp +++ b/Plugin/PluginManager.cpp @@ -37,7 +37,7 @@ #include "MakeSimplex.h" #include "Smooth.h" #include "Transform.h" -#include "TransformLatLon.h" +#include "LongitudeLatitude.h" #include "Triangulate.h" #include "Warp.h" #include "SphericalRaise.h" @@ -184,7 +184,7 @@ void GMSH_PluginManager::registerDefaultPlugins() allPlugins.insert(std::pair<const char*, GMSH_Plugin*> ("Transform", GMSH_RegisterTransformPlugin())); allPlugins.insert(std::pair<const char*, GMSH_Plugin*> - ("TransformLatLon", GMSH_RegisterTransformLatLonPlugin())); + ("LongitudeLatitude",GMSH_RegisterLongituteLatitudePlugin())); allPlugins.insert(std::pair<const char*, GMSH_Plugin*> ("Warp", GMSH_RegisterWarpPlugin())); allPlugins.insert(std::pair<const char*, GMSH_Plugin*> diff --git a/Plugin/TransformLatLon.cpp b/Plugin/TransformLatLon.cpp deleted file mode 100644 index 6c8d7545e7..0000000000 --- a/Plugin/TransformLatLon.cpp +++ /dev/null @@ -1,237 +0,0 @@ -// Gmsh - Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#include "TransformLatLon.h" - -StringXNumber TransformLatLonOptions_Number[] = { - {GMSH_FULLRC, (char *)"iView", NULL, -1.}, - {GMSH_FULLRC, (char *)"Longitude0", NULL, 0.} -}; - -extern "C" -{ - GMSH_Plugin *GMSH_RegisterTransformLatLonPlugin() - { - return new GMSH_TransformLatLonPlugin(); - } -} - -GMSH_TransformLatLonPlugin::GMSH_TransformLatLonPlugin() -{ - ; -} - -void GMSH_TransformLatLonPlugin::getName(char *name) const -{ - strcpy(name, "TransformLatLon"); -} - -void GMSH_TransformLatLonPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "J. Lambrechts"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(TransformLatLon) transforms the homogeneous\n" - "node coordinates (x,y,z,1) of the elements in\n" - "the view `iView' by the matrix\n" - "[`A11' `A12' `A13' `Tx']\n" - "[`A21' `A22' `A23' `Ty']\n" - "[`A31' `A32' `A33' `Tz'].\n" - "If `SwapOrientation' is set, the orientation of the\n" - "elements is reversed. If `iView' < 0, the plugin\n" - "is run on the current view.\n" - "\n" "Plugin(TransformLatLon) is executed in-place.\n"); -} - -int GMSH_TransformLatLonPlugin::getNbOptions() const -{ - return sizeof(TransformLatLonOptions_Number) / sizeof(StringXNumber); -} - -StringXNumber *GMSH_TransformLatLonPlugin::getOption(int iopt) -{ - return &TransformLatLonOptions_Number[iopt]; -} - -void GMSH_TransformLatLonPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "TransformLatLon failed..."); -} - -// TransformLatLonation -static void vector_transform(double *vin, double *vout, double x, - double y, double z) -{ - double theta = y * M_PI / 180; - double phi = x * M_PI / 180; - vout[0] = -sin(phi) * vin[0] + cos(phi) * vin[1]; - vout[1] = - -sin(theta) * (cos(phi) * vin[0] + sin(phi) * vin[1]) + - cos(theta) * vin[2]; - vout[2] = - cos(theta) * (cos(phi) * vin[0] + sin(phi) * vin[1]) + - sin(theta) * vin[2]; -} - -static void transform_list(List_T * list, int nbList, List_T * list2, - int *nbList2, int nbVert, int nbComp, - double rotate) -{ - if(!nbList) - return; - int nb = List_Nbr(list) / nbList; - double *ll_out=new double[nbVert*3]; - double *lon=ll_out; - double *lat=ll_out+nbVert; - double *r=ll_out+nbVert*2; - double *din = new double[nbComp]; - double *dout = new double[nbComp]; - for(int i = 0; i < List_Nbr(list); i += nb) { - double *x = (double *)List_Pointer_Fast(list, i); - double *y = (double *)List_Pointer_Fast(list, i + nbVert); - double *z = (double *)List_Pointer_Fast(list, i + 2 * nbVert); - for(int j = 0; j < nbVert; j++) { - r[j] = sqrt(x[j]*x[j] + y[j]*y[j]+ z[j]*z[j]); - lat[j] = asin(z[j] / r[j]) * 180 / M_PI; - lon[j] = atan2(y[j], x[j]) * 180 / M_PI + rotate; - while(lon[j] > 180) - lon[j] -= 360; - lon[j]+=rotate; - } - // check the periodicity - bool cross = false; - for(int j = 1; j < nbVert; j++) - cross |= (fabs(lon[j] - lon[0]) > 180); - if(cross) - for(int j = 0; j < nbVert; j++) - if(lon[j] < 0) - lon[j] += 360; - for(int j = 0; j < nbVert*3; j++) - List_Add(list2, &ll_out[j]); - for(int k = 0; k < nbVert; k++) { - for(int l = 0; l < nbComp; l++) - List_Read(list, i + 3 * nbVert + nbComp * k + l, &din[l]); - if(nbComp == 1) - dout[0]=din[0]; - else if(nbComp == 3) { - vector_transform(din, dout, lon[k], lat[k], r[k]); - }else if(nbComp == 9){ - - }else{ - - } - for(int l = 0; l < nbComp; l++) - List_Add(list2, &dout[l]); - } - (*nbList2)++; - if(cross) { - for(int j = 0; j < nbVert; j++) - lon[j] -= 360; - for(int j = 0; j < nbVert*3; j++) - List_Add(list2, &ll_out[j]); - for(int k = 0; k < nbVert; k++) { - for(int l = 0; l < nbComp; l++) - List_Read(list, i + 3 * nbVert + nbComp * k + l, &din[l]); - if(nbComp == 1){ - dout[0]=din[0]; - } - else if(nbComp == 3) { - vector_transform(din, dout, lon[k], lat[k], r[k]); - }else if(nbComp == 9){ - - }else{ - - } - for(int l = 0; l < nbComp; l++) - List_Add(list2, &dout[l]); - } - (*nbList2)++; - } - } - delete[]dout; - delete[]din; - delete[]ll_out; -} - -PView *GMSH_TransformLatLonPlugin::execute(PView * v) -{ - int iView = (int)TransformLatLonOptions_Number[0].def; - double rotate = (double)TransformLatLonOptions_Number[1].def; - - PView *v1 = getView(iView, v); - if(!v1) - return v; - PView *v2 = new PView(true); - PViewDataList *data2 = getDataList(v2); - if(!data2) - return v; - - PViewDataList *data1 = getDataList(v1); - if(!data1) - return v; - // points - transform_list(data1->SP, data1->NbSP, data2->SP, &data2->NbSP, 1, 1, - rotate); - transform_list(data1->VP, data1->NbVP, data2->VP, &data2->NbVP, 1, 3, - rotate); - transform_list(data1->TP, data1->NbTP, data2->TP, &data2->NbTP, 1, 9, - rotate); - // lines - transform_list(data1->SL, data1->NbSL, data2->SL, &data2->NbSL, 2, 1, - rotate); - transform_list(data1->VL, data1->NbVL, data2->VL, &data2->NbVL, 2, 3, - rotate); - transform_list(data1->TL, data1->NbTL, data2->TL, &data2->NbTL, 2, 9, - rotate); - // triangles - transform_list(data1->ST, data1->NbST, data2->ST, &data2->NbST, 3, 1, - rotate); - transform_list(data1->VT, data1->NbVT, data2->VT, &data2->NbVT, 3, 3, - rotate); - transform_list(data1->TT, data1->NbTT, data2->TT, &data2->NbTT, 3, 9, - rotate); - // quadrangles - transform_list(data1->SQ, data1->NbSQ, data2->SQ, &data2->NbSQ, 4, 1, - rotate); - transform_list(data1->VQ, data1->NbVQ, data2->VQ, &data2->NbVQ, 4, 3, - rotate); - transform_list(data1->TQ, data1->NbTQ, data2->TQ, &data2->NbTQ, 4, 9, - rotate); - // tets - transform_list(data1->SS, data1->NbSS, data2->SS, &data2->NbSS, 4, 1, - rotate); - transform_list(data1->VS, data1->NbVS, data2->VS, &data2->NbVS, 4, 3, - rotate); - transform_list(data1->TS, data1->NbTS, data2->TS, &data2->NbTS, 4, 9, - rotate); - // hexas - transform_list(data1->SH, data1->NbSH, data2->SH, &data2->NbSH, 8, 1, - rotate); - transform_list(data1->VH, data1->NbVH, data2->VH, &data2->NbVH, 8, 3, - rotate); - transform_list(data1->TH, data1->NbTH, data2->TH, &data2->NbTH, 8, 9, - rotate); - // prisms - transform_list(data1->SI, data1->NbSI, data2->SI, &data2->NbSI, 6, 1, - rotate); - transform_list(data1->VI, data1->NbVI, data2->VI, &data2->NbVI, 6, 3, - rotate); - transform_list(data1->TI, data1->NbTI, data2->TI, &data2->NbTI, 6, 9, - rotate); - // pyramids - transform_list(data1->SY, data1->NbSY, data2->SY, &data2->NbSY, 5, 1, - rotate); - transform_list(data1->VY, data1->NbVY, data2->VY, &data2->NbVY, 5, 3, - rotate); - transform_list(data1->TY, data1->NbTY, data2->TY, &data2->NbTY, 5, 9, - rotate); - - data2->setName(data1->getName() + "_LatLon"); - data2->setFileName(data1->getName() + "_LatLon.pos"); - data2->finalize(); - - return v2; -} -- GitLab