Salome HOME
Enable C++0x/C++11 support
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.hxx
index 885bb90ec2e98266c4411aca5286237fd0deae33..43a4aab0e854f9bee8f41ed1d59f21ae1f5dd6cb 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -38,7 +38,7 @@
 #include <utilities.h>
 #include "BLSURFPlugin_Attractor.hxx"
 
-//  Parameters for work of BLSURF
+//  Parameters for work of MG-CADSurf
 
 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
 {
@@ -64,7 +64,7 @@ public:
     GeometricalLocalSize
   };
 
-  static const char* GetHypType() { return "BLSURF_Parameters"; }
+  static const char* GetHypType() { return "MG-CADSurf Parameters"; }
   
   TopoDS_Shape entryToShape(std::string entry);
 
@@ -128,7 +128,7 @@ public:
   void SetVerbosity(int theVal);
   int GetVerbosity() const { return _verb; }
   
-  void ClearEntry(const std::string& entry);
+  void ClearEntry(const std::string& entry, const char * attEntry = 0);
   void ClearSizeMaps();
 
   void SetPreCADMergeEdges(bool theVal);
@@ -167,7 +167,7 @@ public:
   const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
  */
   
-  typedef std::map< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
+  typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
   typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir 
   
   void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
@@ -216,6 +216,33 @@ public:
     }
   };
 
+  // PreCad Face and Edge periodicity
+  struct TPreCadPeriodicity {
+    TEntry shape1Entry;
+    TEntry shape2Entry;
+    std::vector<std::string> theSourceVerticesEntries;
+    std::vector<std::string> theTargetVerticesEntries;
+  };
+
+  // Edge periodicity
+  struct TEdgePeriodicity {
+    TEntry theFace1Entry;
+    TEntry theEdge1Entry;
+    TEntry theFace2Entry;
+    TEntry theEdge2Entry;
+    int edge_orientation;
+  };
+
+  // Vertex periodicity
+  struct TVertexPeriodicity {
+    TEntry theEdge1Entry;
+    TEntry theVertex1Entry;
+    TEntry theEdge2Entry;
+    TEntry theVertex2Entry;
+  };
+
+  typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
+
   // List of enforced vertices
   typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
 
@@ -243,7 +270,13 @@ public:
   typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
   */
 
+  // Vector of pairs of entries
+  typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
+  typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
+  typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
+  typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
   
+
   bool                  SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
                                           double x = 0.0, double y = 0.0, double z = 0.0);
   TEnfVertexList        GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
@@ -354,6 +387,39 @@ public:
   static TEnfVertexGroupNameMap     GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
   */
 
+//  const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
+
+  static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
+  const TPreCadPeriodicityVector  _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
+  static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
+  const TPreCadPeriodicityVector  _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
+  static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
+  const TFacesPeriodicityVector  _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
+  static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
+  const TEdgesPeriodicityVector  _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
+  static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
+  const TVerticesPeriodicityVector  _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
+  static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  void ClearPreCadPeriodicityVectors();
+
+  void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
+      std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
+  void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
+      std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
+
+  void AddFacePeriodicity(TEntry theFace1Entry, TEntry theFace2Entry);
+  void AddEdgePeriodicity(TEntry theFace1Entry, TEntry theEdge1Entry, TEntry theFace2Entry, TEntry theEdge2Entry, int edge_orientation = 0);
+  void AddVertexPeriodicity(TEntry theEdge1Entry, TEntry theVertex1Entry, TEntry theEdge2Entry, TEntry theVertex2Entry);
+
   static double undefinedDouble() { return -1.0; }
 
   typedef std::map< std::string, std::string > TOptionValues;
@@ -369,6 +435,13 @@ public:
   void ClearPreCADOption(const std::string& optionName);
   const TOptionValues& GetOptionValues() const { return _option2value; }
   const TOptionValues& GetPreCADOptionValues() const { return _preCADoption2value; }
+  const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
+  const TOptionValues& GetCustomPreCADOptionValues() const { return _customPreCADOption2value; }
+
+  void AddOption(const std::string& optionName, const std::string& optionValue);
+  void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
+  std::string GetOption(const std::string& optionName);
+  std::string GetPreCADOption(const std::string& optionName);
 
   /*!
     * Sets the file for export resulting mesh in GMF format
@@ -428,6 +501,7 @@ private:
   double          _preCADEpsNano;
   
   TOptionValues   _option2value, _preCADoption2value;
+  TOptionValues   _customOption2value, _customPreCADOption2value;
   TOptionNames    _doubleOptions, _charOptions;
   TOptionNames    _preCADdoubleOptions, _preCADcharOptions;
   TSizeMap        _sizeMap;
@@ -451,6 +525,37 @@ private:
   bool            _enforcedInternalVerticesAllFaces;
   TEnfGroupName   _enforcedInternalVerticesAllFacesGroup;
   
+  TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
+  TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
+
+  TFacesPeriodicityVector _facesPeriodicityVector;
+  TEdgesPeriodicityVector _edgesPeriodicityVector;
+  TVerticesPeriodicityVector _verticesPeriodicityVector;
+
+  // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
+  void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
+
+  // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
+  void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
+
+  // Called by LoadFrom to fill _facesPeriodicityVector
+  void LoadFacesPeriodicity(std::istream & load);
+
+  // Called by LoadFrom to fill _edgesPeriodicityVector
+  void LoadEdgesPeriodicity(std::istream & load);
+
+  // Called by LoadFrom to fill _verticesPeriodicityVector
+  void LoadVerticesPeriodicity(std::istream & load);
+
+  // Called by SaveTo to store content of _facesPeriodicityVector
+  void SaveFacesPeriodicity(std::ostream & save);
+
+  // Called by SaveTo to store content of _edgesPeriodicityVector
+  void SaveEdgesPeriodicity(std::ostream & save);
+
+  // Called by SaveTo to store content of _verticesPeriodicityVector
+  void SaveVerticesPeriodicity(std::ostream & save);
+
   std::string     _GMFFileName;
 //   bool            _GMFFileMode;