]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
adding OptionManager
authorvbd <vbd>
Wed, 24 Sep 2008 14:27:16 +0000 (14:27 +0000)
committervbd <vbd>
Wed, 24 Sep 2008 14:27:16 +0000 (14:27 +0000)
14 files changed:
src/INTERP_KERNEL/Interpolation3D.hxx
src/INTERP_KERNEL/Interpolation3D.txx
src/INTERP_KERNEL/Interpolation3DSurf.hxx
src/INTERP_KERNEL/Interpolation3DSurf.txx
src/INTERP_KERNEL/InterpolationPlanar.hxx
src/INTERP_KERNEL/InterpolationPlanar.txx
src/INTERP_KERNEL/IntersectorHexa.hxx
src/ParaMEDMEM/DEC.cxx
src/ParaMEDMEM/DEC.hxx
src/ParaMEDMEM/ElementLocator.hxx
src/ParaMEDMEM/InterpolationMatrix.cxx
src/ParaMEDMEM/InterpolationMatrix.hxx
src/ParaMEDMEM/IntersectionDEC.cxx
src/ParaMEDMEM/IntersectionDEC.hxx

index e93d42482fded694be3c41148359eb40c6787537..5584b898feefffa69e6f04e518da849a92e4c6a1 100644 (file)
@@ -3,15 +3,18 @@
 
 #include "Interpolation.hxx"
 #include "NormalizedUnstructuredMesh.hxx"
-
+#include "IntersectorHexa.hxx"
+#include "OptionManager.hxx"
 namespace INTERP_KERNEL
 {
-  class Interpolation3D : public Interpolation<Interpolation3D>
+  class Interpolation3D : public Interpolation<Interpolation3D>,OptionManager
   {
   public:
     Interpolation3D();
     template<class MatrixType, class MyMeshType>
     void interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result);
+       private:
+               SplittingPolicy _splitting_policy;
   };
 }
 
index 135bd9d75e7d4a41ccb6653efd4f082942e1bc9b..a1654cb690f05f1362de6c9ed71836529b6e9b35 100644 (file)
@@ -7,7 +7,7 @@
 #include "IntersectorTetra.txx"
 #include "IntersectorHexa.txx"
 #include "Log.hxx"
-
+#include "OptionManager.hxx"
 /// If defined, use recursion to traverse the binary search tree, else use the BBTree class
 #define USE_RECURSIVE_BBOX_FILTER
 
@@ -36,6 +36,7 @@ namespace INTERP_KERNEL
    */
   Interpolation3D::Interpolation3D()
   {
+               registerOption(&_splitting_policy,"SplittingPolicy",GENERAL_48);
   }
     
   /**
@@ -162,7 +163,10 @@ namespace INTERP_KERNEL
                 break;
 
               case 8:
-                intersector = new IntersectorHexa<MyMeshType>(srcMesh, targetMesh, targetIdx);
+
+                SplittingPolicy sp;
+                                                               getOption("SplittingPolicy",sp);
+                                                               intersector = new IntersectorHexa<MyMeshType>(srcMesh, targetMesh, targetIdx,sp);
                 break;
               
               default:
index 2c2eb107ddc554430fe127140d12cd7ba11b7370..f6c884c72e6b7e75ab2b8ea93e16154e6b3aa97a 100644 (file)
@@ -2,7 +2,7 @@
 #define __INTERPOLATION3DSURF_HXX__
 
 #include "InterpolationPlanar.hxx"
-
+#include "OptionManager.hxx"
 namespace INTERP_KERNEL
 {
   class Interpolation3DSurf : public InterpolationPlanar<Interpolation3DSurf>
index f51e1eb55e0305a0751f5ee2b854c0e3259428aa..b9e14f57fb24fecb77a585187ea39fa3650771c1 100644 (file)
@@ -13,6 +13,9 @@ namespace INTERP_KERNEL
                                             ,_medianPlane(DFT_MEDIAN_PLANE)
                                             ,_surf3DAdjustmentEps(DFT_SURF3D_ADJ_EPS)
   {
+               registerOption(&_medianPlane,"MedianPlane",DFT_MEDIAN_PLANE);
+               registerOption(&_doRotate,"DoRotate",true);
+               registerOption(&_surf3DAdjustmentEps,"BoundingBoxAdjustment",DFT_SURF3D_ADJ_EPS);
   }
 
   /**
index e1db1e4b1aa8e35ea00d11f91a71ab9e9f0a1c3a..22307e8b308f7b567ada790a0a7c7c55687fac8f 100755 (executable)
@@ -4,13 +4,14 @@
 #include "Interpolation.hxx"
 #include "PlanarIntersector.hxx"
 #include "NormalizedUnstructuredMesh.hxx"
+#include "OptionManager.hxx"
 
 namespace INTERP_KERNEL
 {
   typedef enum {Triangulation, Convex, Geometric2D, Generic} IntersectionType;
 
   template<class RealPlanar>
-  class InterpolationPlanar : public Interpolation< InterpolationPlanar<RealPlanar> >
+  class InterpolationPlanar : public Interpolation< InterpolationPlanar<RealPlanar> >, public OptionManager
   {
   private: 
     int  _printLevel;
index b2d2ade7afc518f289d74ff4f61a67885c5cdb47..3aa78b5c37f42ed14c0ab3b3e126786ef64bc596 100644 (file)
@@ -10,8 +10,6 @@
 #include "ConvexIntersector.txx"
 #include "Geometric2DIntersector.hxx"
 #include "Geometric2DIntersector.txx"
-//#include "GenericIntersector.hxx"
-//#include "GenericIntersector.cxx"
 #include "VectorUtils.hxx"
 #include "BBTree.txx"
 #include<time.h>
@@ -33,6 +31,9 @@ namespace INTERP_KERNEL
   InterpolationPlanar<RealPlanar>::InterpolationPlanar():_printLevel(0),_precision(DEFAULT_PRECISION),_dimCaracteristic(1),
                                                          _intersectionType(Triangulation)
   {
+               registerOption(&_precision, "Precision",DEFAULT_PRECISION);
+               registerOption(&_intersectionType, "IntersectionType",Triangulation);
+               registerOption(&_printLevel, "PrintLevel",0);
   }
 
   /**
index 9105dafbc40c701b8217485197a68048bf052553..b50e3552c2a58520597856cb0dc352c0fbddef07 100644 (file)
@@ -4,25 +4,28 @@
 #include "TargetIntersector.hxx"
 #include "IntersectorTetra.hxx"
 #include "NormalizedUnstructuredMesh.hxx"
-
+#include "OptionManager.hxx"
 namespace INTERP_KERNEL
 {
+
+ /// Type describing the different ways in which the hexahedron can be split into tetrahedra.
+    /// The PLANAR_* policies persume that each face is to be considered planar, while the general
+    /// policies make no such hypothesis. The integer at the end gives the number of tetrahedra
+    /// that result from the split.
+    enum SplittingPolicy { PLANAR_FACE_5 = 5, PLANAR_FACE_6 = 6, GENERAL_24 = 24, GENERAL_48 = 48 };
+
   /** 
    * \brief Class responsible for calculating intersection between a hexahedron target element and  
    * the source elements.
    *
    */
   template<class MyMeshType>
-  class IntersectorHexa : public TargetIntersector<typename MyMeshType::MyConnType>
+  class IntersectorHexa : public TargetIntersector<typename MyMeshType::MyConnType>, public OptionManager
   {
 
   public:
 
-    /// Type describing the different ways in which the hexahedron can be split into tetrahedra.
-    /// The PLANAR_* policies persume that each face is to be considered planar, while the general
-    /// policies make no such hypothesis. The integer at the end gives the number of tetrahedra
-    /// that result from the split.
-    enum SplittingPolicy { PLANAR_FACE_5 = 5, PLANAR_FACE_6 = 6, GENERAL_24 = 24, GENERAL_48 = 48 };
+   
 
     IntersectorHexa(const MyMeshType& srcMesh, const MyMeshType& targetMesh,
                     typename MyMeshType::MyConnType targetCell, SplittingPolicy policy = GENERAL_24);
index 315a971d21b9afadf1704296177da7bb93f0eb6e..84e694f9ad3fa0ec820761571f9ed79870790e61 100644 (file)
  * <TR><TD>ForcedRenormalization</TD><TD>After receiving data, the target field is renormalized so that L2-norms of the source and target fields match.</TD><TD> false </TD></TR>
  *</TABLE>
 
+
+The following code excerpt shows how to set options for an object that inherits from DEC :
+
+\code
+ IntersectionDEC dec(local_group,distant_group);
+ dec.setOptions("ForcedRenormalization",true);
+ dec.attachLocalField(field);
+ dec.synchronize();
+ if (local_group.containsMyRank())
+    dec.sendData();
+ else
+    dec.recvData();
+\endcode
 */
 
 namespace ParaMEDMEM
index 02f8666ff77bab31f2af2861403bf10ea3e75850..6c627a06738e3adc9c0e102859b76057139a27f1 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DEC_HXX_
 #define DEC_HXX_
 
-#include "MEDMEM_OptionManager.hxx"
+#include "OptionManager.hxx"
 #include <MEDMEM_Field.hxx>
 #include <NormalizedUnstructuredMesh.hxx>
 
@@ -15,7 +15,7 @@ namespace ParaMEDMEM
        class ProcessorGroup;
        class ParaFIELD;
        class CommInterface;
-       class DEC : public MEDMEM::OptionManager
+       class DEC : public INTERP_KERNEL::OptionManager
        {
        public:
                DEC():_local_field(0),_forced_renormalization_flag(false){}
index 2423cfb362d51a15858fb7a1ae0adf9639fc8bb2..5345db3cd101ab8847e6ed600f022bd6e6631991 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <vector>
 #include <set>
-#include "MEDMEM_OptionManager.hxx"
+#include "OptionManager.hxx"
 
 namespace MEDMEM
 {
@@ -17,7 +17,7 @@ class ParaSUPPORT;
 class InterpolationMatrix;
 
 
-       class ElementLocator: public MEDMEM::OptionManager
+       class ElementLocator: public INTERP_KERNEL::OptionManager
 {
 public:
        ElementLocator(const ParaMESH& mesh, const ProcessorGroup& distant_group);
index 6a55b6abc6f51a6d14dddb3c6dfb44bbc68baac0..0bf7d7c0a65537f2bdcc0f3b5748faea97059a72 100644 (file)
@@ -33,10 +33,10 @@ InterpolationMatrix::InterpolationMatrix(
 const ParaMEDMEM::ParaMESH& source_support, 
 const ProcessorGroup& source_group,
 const ProcessorGroup& target_group, 
-const string& method):
+const OptionManager& option_manager):
+       OptionManager(option_manager),
        _source_support(*source_support.getMesh()),
        _mapping(source_group, target_group),
-       _method(method),
        _source_group(source_group),
        _target_group(target_group),
        _source_volume(0)
@@ -86,6 +86,16 @@ void InterpolationMatrix::addContribution(MEDMEM::MESH& distant_support, int ipr
        MEDNormalizedUnstructuredMesh<3,2>target_wrapper(&distant_support);
        MEDNormalizedUnstructuredMesh<3,2> source_wrapper(&_source_support);
                INTERP_KERNEL::Interpolation3DSurf interpolator;
+               double precision, median_plane;
+               int print_level;
+               INTERP_KERNEL::IntersectionType inter_type;
+               bool do_rotate;
+               getOption("DoRotate",do_rotate);
+               getOption("Precision",precision);
+               getOption("MedianPlane",median_plane);
+               getOption("PrintLevel",print_level);
+               getOption("IntersectionType",inter_type);
+               interpolator.setOptions(precision,print_level,median_plane,inter_type,do_rotate);
                interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces);
        }
        else if (distant_support.getMeshDimension()==2 && distant_support.getSpaceDimension()==2)
index 642783581ec59446ca5b5e7009c5a9a5a070f119..bc55d9a78cee8f57dd2d8cc5a998e88fb18a913d 100644 (file)
@@ -4,17 +4,17 @@
 #include "MEDMEM_Field.hxx"
 #include "MPI_AccessDEC.hxx"
 #include "MxN_Mapping.hxx"
-
+#include "OptionManager.hxx"
 namespace ParaMEDMEM
 {
-  class InterpolationMatrix
+  class InterpolationMatrix : public INTERP_KERNEL::OptionManager
   {
   public:
     
     InterpolationMatrix(const ParaMEDMEM::ParaMESH& source_support, 
                        const ProcessorGroup& local_group,
                        const ProcessorGroup& distant_group, 
-                       const string& method);
+                       const INTERP_KERNEL::OptionManager& option_manager);
     
     virtual ~InterpolationMatrix();
     void addContribution(MEDMEM::MESH& distant_support, int iproc_distant, int* distant_elems);
index ace1f9f041ad5a5cbaafa556c1f10078434ecdb6..3a88d4c540b56ae4cbe753a698266c8ea5f6d659 100644 (file)
@@ -7,12 +7,12 @@
 #include "MPIProcessorGroup.hxx"
 #include "ParaMESH.hxx"
 #include "ParaSUPPORT.hxx"
-#include "MEDMEM_OptionManager.hxx"
+#include "OptionManager.hxx"
 #include "DEC.hxx"
 #include "InterpolationMatrix.hxx"
 #include "IntersectionDEC.hxx"
 #include "ElementLocator.hxx"
-#include "MEDMEM_OptionManager.hxx"
+#include "OptionManager.hxx"
 
 
 namespace ParaMEDMEM
@@ -66,16 +66,24 @@ In the P0-P0 case, this matrix is a plain rectangular matrix with coefficients e
 
 
 
-/* \section intersectiondec_options Options
- * On top of \ref dec_options, options supported by IntersectionDEC objects are
- *
- * <TABLE BORDER=1 >
- * <TR><TD>Option</TD><TD>Description</TD><TD>Default value</TD></TR>
- * <TR><TD>BoundingBoxAdjustment</TD><TD>When detecting an intersection between bounding boxes, the bounding are expanded by a factor (1+BoundingBoxAdjustment). It is particularly useful when detecting intersections for 3D surfaces for which the bounding boxes might not actually intersect.</TD><TD> 0.1 </TD></TR>
- <TR><TD>Method</TD><TD>Specifies the field representation used for the remapping.</TD><TD>P0</TD></TR>
- *</TABLE>
-
+  \section intersectiondec_options Options
+  On top of \ref dec_options, options supported by %IntersectionDEC objects are
+  related to the underlying Intersector class. 
+  All the options available in the intersector objects are
+  available for the %IntersectionDEC object. The various options available for  * intersectors can be reviewed in \ref InterpKerIntersectors.
+ For instance :
+  \verbatim
+       IntersectionDEC dec(source_group, target_group);
+       dec.attachLocalField(field);
+       dec.setOptions("DoRotate",false);
+       dec.setOptions("Precision",1e-12);
+       dec.synchronize();
+       \endverbatim
+
+       \warning{       Options must be set before calling the synchronize method. }
 */
+
 /*!
 \addtogroup intersectiondec
 @{
@@ -99,7 +107,13 @@ IntersectionDEC::IntersectionDEC(ProcessorGroup& local_group, ProcessorGroup& di
 {
        registerOption(&_method,string("Method"),string("P0"));
        registerOption(&_bb_adjustment, "BoundingBoxAdjustment",0.1);
+       registerOption(&_intersection_type, "IntersectionType",INTERP_KERNEL::Triangulation);
+       registerOption(&_precision, "Precision", 1e-12);
+       registerOption(&_median_plane, "MedianPlane",0.5);
+       registerOption(&_do_rotate, "DoRotate",true);
        registerOption(&_asynchronous, "Asynchronous",false);
+       registerOption(&_splitting_policy, "SplittingPolicy",INTERP_KERNEL::GENERAL_48);
+       registerOption(&_print_level,"PrintLevel",0);
   registerOption(&_timeinterpolationmethod,"TimeInterpolation",WithoutTimeInterp);
   registerOption(&_allToAllMethod,"AllToAllMethod",Native);
 }
@@ -127,7 +141,7 @@ void IntersectionDEC::synchronize()
 {
        const ParaMEDMEM::ParaMESH* para_mesh = _local_field->getSupport()->getMesh();
        //cout <<"size of Interpolation Matrix"<<sizeof(InterpolationMatrix)<<endl;
-       _interpolation_matrix = new InterpolationMatrix (*para_mesh, *_source_group,*_target_group,"P0"); 
+       _interpolation_matrix = new InterpolationMatrix (*para_mesh, *_source_group,*_target_group,*this); 
   _interpolation_matrix->setAllToAllMethod(_allToAllMethod);
   _interpolation_matrix->getAccessDEC()->Asynchronous( _asynchronous ) ;
   _interpolation_matrix->getAccessDEC()->SetTimeInterpolator( _timeinterpolationmethod ) ;
@@ -174,7 +188,7 @@ void IntersectionDEC::synchronize()
       ElementLocator locator(*para_mesh, *_source_group);
                        //transfering option from IntersectionDEC to ElementLocator
                        double bb_adj;
-                       MEDMEM::OptionManager::getOption("BoundingBoxAdjustment",bb_adj);
+                       INTERP_KERNEL::OptionManager::getOption("BoundingBoxAdjustment",bb_adj);
                        locator.setOption("BoundingBoxAdjustment",bb_adj);
 
       MESH* distant_mesh=0;
index 5133c9e94506f47fa642ac292a2c1daf8efdb380..09ec5067f8fe552cc8603a999b2789fb1e1241d9 100644 (file)
@@ -1,12 +1,14 @@
 #ifndef INTERSECTIONDEC_HXX_
 #define INTERSECTIONDEC_HXX_
 
-#include "MEDMEM_OptionManager.hxx"
+#include "DEC.hxx"
 #include "MPI_AccessDEC.hxx"
 #include "MxN_Mapping.hxx" 
+#include "InterpolationPlanar.hxx"
+#include "IntersectorHexa.hxx"
+
 namespace ParaMEDMEM
 {
-  class DEC;
   class InterpolationMatrix;
 
   class IntersectionDEC:public DEC
@@ -45,11 +47,19 @@ namespace ParaMEDMEM
    
    InterpolationMatrix* _interpolation_matrix;
 
+               //options
                double _bb_adjustment;
-
                bool _asynchronous;
     TimeInterpolationMethod _timeinterpolationmethod ;
                AllToAllMethod _allToAllMethod;
+               INTERP_KERNEL::IntersectionType _intersection_type;
+               double _precision;
+               double _median_plane;
+               bool _do_rotate;
+               INTERP_KERNEL::SplittingPolicy _splitting_policy;
+               int _print_level;
+               
+
   };
 }