Back to index

salome-smesh  6.5.0
StdMeshers_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH StdMeshers : implementaion of SMESH idl descriptions
00024 //  File   : StdMeshers_i.cxx
00025 //  Author : Julia DOROVSKIKH
00026 //  Module : SMESH
00027 //
00028 #include "SMESH_StdMeshers_I.hxx"
00029 
00030 #include "SMESH_Gen_i.hxx"
00031 
00032 #include "utilities.h"
00033 
00034 #include "StdMeshers_LocalLength_i.hxx"
00035 #include "StdMeshers_AutomaticLength_i.hxx"
00036 #include "StdMeshers_StartEndLength_i.hxx"
00037 #include "StdMeshers_Arithmetic1D_i.hxx"
00038 #include "StdMeshers_FixedPoints1D_i.hxx"
00039 #include "StdMeshers_NumberOfSegments_i.hxx"
00040 #include "StdMeshers_Deflection1D_i.hxx"
00041 #include "StdMeshers_Propagation_i.hxx"
00042 #include "StdMeshers_LengthFromEdges_i.hxx"
00043 #include "StdMeshers_QuadranglePreference_i.hxx"
00044 //#include "StdMeshers_TrianglePreference_i.hxx"
00045 #include "StdMeshers_QuadraticMesh_i.hxx"
00046 #include "StdMeshers_MaxElementArea_i.hxx"
00047 #include "StdMeshers_MaxElementVolume_i.hxx"
00048 #include "StdMeshers_NotConformAllowed_i.hxx"
00049 #include "StdMeshers_ProjectionSource3D_i.hxx"
00050 #include "StdMeshers_ProjectionSource2D_i.hxx"
00051 #include "StdMeshers_ProjectionSource1D_i.hxx"
00052 #include "StdMeshers_NumberOfLayers_i.hxx"
00053 #include "StdMeshers_LayerDistribution_i.hxx"
00054 #include "StdMeshers_NumberOfLayers2D_i.hxx"
00055 #include "StdMeshers_LayerDistribution2D_i.hxx"
00056 #include "StdMeshers_SegmentLengthAroundVertex_i.hxx"
00057 #include "StdMeshers_MaxLength_i.hxx"
00058 #include "StdMeshers_QuadrangleParams_i.hxx"
00059 #include "StdMeshers_ImportSource1D_i.hxx"
00060 #include "StdMeshers_ImportSource2D_i.hxx"
00061 #include "StdMeshers_Cartesian_3D_i.hxx"
00062 
00063 #include "StdMeshers_Regular_1D_i.hxx"
00064 #include "StdMeshers_MEFISTO_2D_i.hxx"
00065 #include "StdMeshers_Quadrangle_2D_i.hxx"
00066 #include "StdMeshers_Hexa_3D_i.hxx"
00067 #include "StdMeshers_Projection_1D_2D_3D_i.hxx"
00068 #include "StdMeshers_Prism_3D_i.hxx"
00069 #include "StdMeshers_SegmentAroundVertex_0D_i.hxx"
00070 #include "StdMeshers_CompositeSegment_1D_i.hxx"
00071 #include "StdMeshers_UseExisting_1D2D_i.hxx"
00072 #include "StdMeshers_RadialQuadrangle_1D2D_i.hxx"
00073 #include "StdMeshers_Import_1D_i.hxx"
00074 #include "StdMeshers_Import_1D2D_i.hxx"
00075 #include "StdMeshers_ViscousLayers_i.hxx"
00076 #include "StdMeshers_CartesianParameters3D_i.hxx"
00077 
00078 template <class T> class StdHypothesisCreator_i:public HypothesisCreator_i<T>
00079 {
00080 public:
00081   // as we have 'module StdMeshers' in SMESH_BasicHypothesis.idl
00082   virtual std::string GetModuleName() { return "StdMeshers"; }
00083 };
00084 
00085 //=============================================================================
00090 //=============================================================================
00091 
00092 template <StdMeshers::QuadType TYPE>
00093 class QuadrangleParamsCreator : public StdHypothesisCreator_i<StdMeshers_QuadrangleParams_i>
00094 {
00095 public:
00096   virtual SMESH_Hypothesis_i* Create (PortableServer::POA_ptr thePOA,
00097                                       int                     theStudyId,
00098                                       ::SMESH_Gen*            theGenImpl)
00099   {
00100     StdMeshers_QuadrangleParams_i* h =
00101       new StdMeshers_QuadrangleParams_i( thePOA, theStudyId, theGenImpl);
00102     h->SetQuadType( TYPE );
00103     return h;
00104   }
00105 };
00106 
00107 //=============================================================================
00111 //=============================================================================
00112 
00113 extern "C"
00114 {
00115 STDMESHERS_I_EXPORT
00116   GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
00117   {
00118     MESSAGE("Get HypothesisCreator for " << aHypName);
00119 
00120     GenericHypothesisCreator_i* aCreator = 0;
00121 
00122     // Hypotheses
00123     if      (strcmp(aHypName, "LocalLength") == 0)
00124       aCreator = new StdHypothesisCreator_i<StdMeshers_LocalLength_i>;
00125     else if (strcmp(aHypName, "MaxLength") == 0)
00126       aCreator = new StdHypothesisCreator_i<StdMeshers_MaxLength_i>;
00127     else if (strcmp(aHypName, "NumberOfSegments") == 0)
00128       aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfSegments_i>;
00129     else if (strcmp(aHypName, "LengthFromEdges") == 0)
00130       aCreator = new StdHypothesisCreator_i<StdMeshers_LengthFromEdges_i>;
00131     else if (strcmp(aHypName, "NotConformAllowed") == 0)
00132       aCreator = new StdHypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
00133     else if (strcmp(aHypName, "Propagation") == 0)
00134       aCreator = new StdHypothesisCreator_i<StdMeshers_Propagation_i>;
00135     else if (strcmp(aHypName, "MaxElementArea") == 0)
00136       aCreator = new StdHypothesisCreator_i<StdMeshers_MaxElementArea_i>;
00137     else if (strcmp(aHypName, "MaxElementVolume") == 0)
00138       aCreator = new StdHypothesisCreator_i<StdMeshers_MaxElementVolume_i>;
00139     else if (strcmp(aHypName, "StartEndLength") == 0)
00140       aCreator = new StdHypothesisCreator_i<StdMeshers_StartEndLength_i>;
00141     else if (strcmp(aHypName, "Deflection1D") == 0)
00142       aCreator = new StdHypothesisCreator_i<StdMeshers_Deflection1D_i>;
00143     else if (strcmp(aHypName, "FixedPoints1D") == 0)
00144       aCreator = new StdHypothesisCreator_i<StdMeshers_FixedPoints1D_i>;
00145     else if (strcmp(aHypName, "Arithmetic1D") == 0)
00146       aCreator = new StdHypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
00147     else if (strcmp(aHypName, "AutomaticLength") == 0)
00148       aCreator = new StdHypothesisCreator_i<StdMeshers_AutomaticLength_i>;
00149     else if (strcmp(aHypName, "QuadranglePreference") == 0)
00150       // do not convert to StdMeshers_QuadrangleParams_i as it is used by NETGEN 2D
00151       aCreator = new StdHypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
00152       //aCreator = new QuadrangleParamsCreator< StdMeshers::QUAD_QUADRANGLE_PREF >();
00153     else if (strcmp(aHypName, "TrianglePreference") == 0)
00154       //aCreator = new StdHypothesisCreator_i<StdMeshers_TrianglePreference_i>;
00155       aCreator = new QuadrangleParamsCreator< StdMeshers::QUAD_TRIANGLE_PREF >();
00156     else if (strcmp(aHypName, "QuadraticMesh") == 0)
00157       aCreator = new StdHypothesisCreator_i<StdMeshers_QuadraticMesh_i>;
00158     else if (strcmp(aHypName, "ProjectionSource3D") == 0)
00159       aCreator = new StdHypothesisCreator_i<StdMeshers_ProjectionSource3D_i>;
00160     else if (strcmp(aHypName, "ProjectionSource2D") == 0)
00161       aCreator = new StdHypothesisCreator_i<StdMeshers_ProjectionSource2D_i>;
00162     else if (strcmp(aHypName, "ProjectionSource1D") == 0)
00163       aCreator = new StdHypothesisCreator_i<StdMeshers_ProjectionSource1D_i>;
00164     else if (strcmp(aHypName, "NumberOfLayers") == 0)
00165       aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfLayers_i>;
00166     else if (strcmp(aHypName, "LayerDistribution") == 0)
00167       aCreator = new StdHypothesisCreator_i<StdMeshers_LayerDistribution_i>;
00168     else if (strcmp(aHypName, "NumberOfLayers2D") == 0)
00169       aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfLayers2D_i>;
00170     else if (strcmp(aHypName, "LayerDistribution2D") == 0)
00171       aCreator = new StdHypothesisCreator_i<StdMeshers_LayerDistribution2D_i>;
00172     else if (strcmp(aHypName, "SegmentLengthAroundVertex") == 0)
00173       aCreator = new StdHypothesisCreator_i<StdMeshers_SegmentLengthAroundVertex_i>;
00174     else if (strcmp(aHypName, "QuadrangleParams") == 0)
00175       aCreator = new StdHypothesisCreator_i<StdMeshers_QuadrangleParams_i>;
00176     else if (strcmp(aHypName, "ImportSource1D") == 0)
00177       aCreator = new StdHypothesisCreator_i<StdMeshers_ImportSource1D_i>;
00178     else if (strcmp(aHypName, "ImportSource2D") == 0)
00179       aCreator = new StdHypothesisCreator_i<StdMeshers_ImportSource2D_i>;
00180     else if (strcmp(aHypName, "ViscousLayers") == 0)
00181       aCreator = new StdHypothesisCreator_i<StdMeshers_ViscousLayers_i>;
00182     else if (strcmp(aHypName, "CartesianParameters3D") == 0)
00183       aCreator = new StdHypothesisCreator_i<StdMeshers_CartesianParameters3D_i>;
00184 
00185     // Algorithms
00186     else if (strcmp(aHypName, "Regular_1D") == 0)
00187       aCreator = new StdHypothesisCreator_i<StdMeshers_Regular_1D_i>;
00188     else if (strcmp(aHypName, "MEFISTO_2D") == 0)
00189       aCreator = new StdHypothesisCreator_i<StdMeshers_MEFISTO_2D_i>;
00190     else if (strcmp(aHypName, "Quadrangle_2D") == 0)
00191       aCreator = new StdHypothesisCreator_i<StdMeshers_Quadrangle_2D_i>;
00192     else if (strcmp(aHypName, "Hexa_3D") == 0)
00193       aCreator = new StdHypothesisCreator_i<StdMeshers_Hexa_3D_i>;
00194     else if (strcmp(aHypName, "Projection_1D") == 0)
00195       aCreator = new StdHypothesisCreator_i<StdMeshers_Projection_1D_i>;
00196     else if (strcmp(aHypName, "Projection_1D2D") == 0)
00197       aCreator = new StdHypothesisCreator_i<StdMeshers_Projection_1D2D_i>;
00198     else if (strcmp(aHypName, "Projection_2D") == 0)
00199       aCreator = new StdHypothesisCreator_i<StdMeshers_Projection_2D_i>;
00200     else if (strcmp(aHypName, "Projection_3D") == 0)
00201       aCreator = new StdHypothesisCreator_i<StdMeshers_Projection_3D_i>;
00202     else if (strcmp(aHypName, "Prism_3D") == 0)
00203       aCreator = new StdHypothesisCreator_i<StdMeshers_Prism_3D_i>;
00204     else if (strcmp(aHypName, "RadialPrism_3D") == 0)
00205       aCreator = new StdHypothesisCreator_i<StdMeshers_RadialPrism_3D_i>;
00206     else if (strcmp(aHypName, "SegmentAroundVertex_0D") == 0)
00207       aCreator = new StdHypothesisCreator_i<StdMeshers_SegmentAroundVertex_0D_i>;
00208     else if (strcmp(aHypName, "CompositeSegment_1D") == 0)
00209       aCreator = new StdHypothesisCreator_i<StdMeshers_CompositeSegment_1D_i>;
00210     else if (strcmp(aHypName, "UseExisting_1D") == 0)
00211       aCreator = new StdHypothesisCreator_i<StdMeshers_UseExisting_1D_i>;
00212     else if (strcmp(aHypName, "UseExisting_2D") == 0)
00213       aCreator = new StdHypothesisCreator_i<StdMeshers_UseExisting_2D_i>;
00214     else if (strcmp(aHypName, "RadialQuadrangle_1D2D") == 0)
00215       aCreator = new StdHypothesisCreator_i<StdMeshers_RadialQuadrangle_1D2D_i>;
00216     else if (strcmp(aHypName, "Import_1D") == 0)
00217       aCreator = new StdHypothesisCreator_i<StdMeshers_Import_1D_i>;
00218     else if (strcmp(aHypName, "Import_1D2D") == 0)
00219       aCreator = new StdHypothesisCreator_i<StdMeshers_Import_1D2D_i>;
00220     else if (strcmp(aHypName, "Cartesian_3D") == 0)
00221       aCreator = new StdHypothesisCreator_i<StdMeshers_Cartesian_3D_i>;
00222     else ;
00223 
00224     return aCreator;
00225   }
00226 }