Salome HOME
Updated copyright comment
[modules/homard.git] / src / HOMARD / HOMARD_Zone.cxx
index 6e8473be29e934754ef2d3357e0c9dff974798af..556c770c552858aab729fa9bcaa6dea579fd4b9a 100644 (file)
@@ -1,11 +1,11 @@
-//  HOMARD HOMARD : implementaion of HOMARD idl descriptions
+//  HOMARD HOMARD : implementation of HOMARD idl descriptions
 //
-// Copyright (C) 2011-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2024  CEA, EDF
 //
 // 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
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //  File   : HOMARD_Zone.cxx
-//  Author : Paul RASCLE, EDF
+//  Author : Gerald NICOLAS, EDF
 //  Module : HOMARD
+//
+// Remarques :
+// L'ordre de description des fonctions est le meme dans tous les fichiers
+// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
+// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
+// 2. Les caracteristiques
+// 3. Le lien avec les autres structures
+//
+// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
 
 #include "HOMARD_Zone.hxx"
+#include "HOMARD.hxx"
 #include "utilities.h"
 
 //=============================================================================
@@ -45,19 +55,20 @@ HOMARD_Zone::~HOMARD_Zone()
 {
   MESSAGE("~HOMARD_Zone") ;
 }
-
+//=============================================================================
+//=============================================================================
+// Generalites
+//=============================================================================
 //=============================================================================
 void HOMARD_Zone::SetName( const char* Name )
 {
-  _Name = std::string( Name ) ;
+  _Name = std::string( Name );
 }
-
 //=============================================================================
 std::string HOMARD_Zone::GetName() const
 {
   return _Name;
 }
-
 //=============================================================================
 std::string HOMARD_Zone::GetDumpPython() const
 {
@@ -65,12 +76,12 @@ std::string HOMARD_Zone::GetDumpPython() const
 //   MESSAGE("GetDumpPython avec _Name " << _Name) ;
   std::ostringstream aScript;
   aScript << "\n# Creation of the ";
-  if ( _Type >= 11 and _Type <= 13 ) { aScript << "rectangle " ; }
+  if ( _Type >= 11 && _Type <= 13 ) { aScript << "rectangle " ; }
   else if ( _Type == 2 ) { aScript << "box " ;}
-  else if ( _Type >= 31 and _Type <= 33 ) { aScript << "disk " ;}
+  else if ( _Type >= 31 && _Type <= 33 ) { aScript << "disk " ;}
   else if ( _Type == 4 ) { aScript << "sphere " ; }
   else if ( _Type == 5 ) { aScript << "cylinder " ; }
-  else if ( _Type >= 61 and _Type <= 63 ) { aScript << "disk with hole " ;}
+  else if ( _Type >= 61 && _Type <= 63 ) { aScript << "disk with hole " ;}
   else if ( _Type == 7 ) { aScript << "pipe " ; }
   aScript << _Name << "\n" ;
 //
@@ -137,24 +148,20 @@ std::string HOMARD_Zone::GetDumpPython() const
 
   return aScript.str() ;
 }
-
+//=============================================================================
+//=============================================================================
+// Caracteristiques
+//=============================================================================
 //=============================================================================
 void HOMARD_Zone::SetType( int Type )
 {
   _Type = Type;
 }
-
 //=============================================================================
 int HOMARD_Zone::GetType() const
 {
   return _Type;
 }
-
-//======================================================================
-void HOMARD_Zone::SetLimit( double X0, double X1, double X2 )
-{
-  _Xincr = X0; _Yincr = X1; _Zincr = X2;
-}
 //=======================================================================================
 void HOMARD_Zone::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
 {
@@ -162,16 +169,6 @@ void HOMARD_Zone::SetBox( double X0, double X1, double X2, double X3, double X4,
   _Ymin = X2; _Ymax = X3;
   _Zmin = X4; _Zmax = X5;
 }
-
-//======================================================================
-void HOMARD_Zone::SetSphere( double X0, double X1, double X2, double X3 )
-{
-  _Xcentre = X0;
-  _Ycentre = X1;
-  _Zcentre = X2;
-  _Rayon = X3;
-}
-
 //=======================================================================================
 void HOMARD_Zone::SetCylinder( double X0, double X1, double X2,
                                double X3, double X4, double X5, double X6, double X7 )
@@ -199,17 +196,14 @@ void HOMARD_Zone::SetPipe( double X0, double X1, double X2,
   _Haut = X7;
   _Rayonint = X8;
 }
-
-//=======================================================================================
-std::vector<double> HOMARD_Zone::GetLimit() const
+//======================================================================
+void HOMARD_Zone::SetSphere( double X0, double X1, double X2, double X3 )
 {
-  std::vector<double> mesLimit;
-  mesLimit.push_back( _Xincr ) ;
-  mesLimit.push_back( _Yincr ) ;
-  mesLimit.push_back( _Zincr ) ;
-  return mesLimit;
+  _Xcentre = X0;
+  _Ycentre = X1;
+  _Zcentre = X2;
+  _Rayon = X3;
 }
-
 //=======================================================================================
 std::vector<double> HOMARD_Zone::GetCoords() const
 {
@@ -282,17 +276,38 @@ std::vector<double> HOMARD_Zone::GetCoords() const
       mesCoor.push_back( _Rayonint ) ;
       break ;
     }
-    ASSERT ( _Type == -1 ) ;
+    VERIFICATION ( ( (_Type>10) && (_Type<14) ) || (_Type==2) || ( (_Type>30) && (_Type<34) ) || (_Type==4) || (_Type==5) || ( (_Type>60) && (_Type<64) ) || (_Type==7) ) ;
   }
   return mesCoor;
 }
-
+//======================================================================
+void HOMARD_Zone::SetLimit( double X0, double X1, double X2 )
+{
+  _Xincr = X0; _Yincr = X1; _Zincr = X2;
+}
+//=======================================================================================
+std::vector<double> HOMARD_Zone::GetLimit() const
+{
+  std::vector<double> mesLimit;
+  mesLimit.push_back( _Xincr ) ;
+  mesLimit.push_back( _Yincr ) ;
+  mesLimit.push_back( _Zincr ) ;
+  return mesLimit;
+}
+//=============================================================================
+//=============================================================================
+// Liens avec les autres structures
+//=============================================================================
 //=============================================================================
 void HOMARD_Zone::AddHypo( const char* NomHypo )
 {
   _ListHypo.push_back( std::string( NomHypo ) ) ;
 }
-
+//=============================================================================
+const std::list<std::string>& HOMARD_Zone::GetHypo() const
+{
+  return _ListHypo;
+}
 //=============================================================================
 void HOMARD_Zone::SupprHypo( const char* NomHypo )
 {
@@ -300,16 +315,9 @@ void HOMARD_Zone::SupprHypo( const char* NomHypo )
   if ( it != _ListHypo.end() )
   {
     MESSAGE ("Dans SupprHypo pour " << NomHypo) ;
-    _ListHypo.erase( it ) ;
+    it = _ListHypo.erase( it ) ;
   }
 }
-
-//=============================================================================
-const std::list<std::string>& HOMARD_Zone::GetHypo() const
-{
-  return _ListHypo;
-}
-
 //=============================================================================
 void HOMARD_Zone::SupprHypos()
 {