Back to index

salome-med  6.5.0
MED_Utilities.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 //  File   : 
00024 //  Author : 
00025 //  Module : 
00026 //  $Header: /home/server/cvs/MED/MED_SRC/src/MEDWrapper/Base/MED_Utilities.cxx,v 1.6.2.1.18.3.2.1 2012-04-13 08:48:43 vsr Exp $
00027 //
00028 #include "MED_Utilities.hxx"
00029 #include "MED_Common.hxx"
00030 
00031 using namespace std;
00032 
00033 #ifdef _DEBUG_
00034 static int MYDEBUG = 0;
00035 #else
00036 // static int MYDEBUG = 0;
00037 #endif
00038 
00039 
00040 int MED::PrefixPrinter::myCounter = 0;
00041 
00042 MED::PrefixPrinter::PrefixPrinter(bool theIsActive):
00043   myIsActive(theIsActive)
00044 {
00045   if(myIsActive)
00046     myCounter++;
00047   MSG(MYDEBUG,"MED::PrefixPrinter::PrefixPrinter(...)- "<<myCounter);
00048 }
00049 
00050 MED::PrefixPrinter::~PrefixPrinter()
00051 {
00052   if(myIsActive){
00053     myCounter--;
00054     if(myCounter < 0)
00055       EXCEPTION(runtime_error,"PrefixPrinter::~PrefixPrinter() - myCounter("<<myCounter<<") < 0");
00056   }
00057 }
00058 
00059 string MED::PrefixPrinter::GetPrefix()
00060 {
00061   if(myCounter){
00062     if(myCounter < 0)
00063       EXCEPTION(runtime_error,"PrefixPrinter::~PrefixPrinter() - myCounter("<<myCounter<<") < 0");
00064     return string(myCounter*2,' ');
00065   }
00066   return "";
00067 }
00068 
00069 
00070 static MED::TEntity2GeomSet Entity2GeomSet;
00071 
00072 bool InitEntity2GeomSet()
00073 {
00074   using namespace MED;
00075 
00076   TGeomSet& aGeomARETESet = Entity2GeomSet[eARETE];
00077   aGeomARETESet.insert(eSEG2);
00078   aGeomARETESet.insert(eSEG3);
00079 
00080   TGeomSet& aGeomFACESet = Entity2GeomSet[eFACE];
00081   aGeomFACESet.insert(eTRIA3);
00082   aGeomFACESet.insert(eQUAD4);
00083   aGeomFACESet.insert(eTRIA6);
00084   aGeomFACESet.insert(eQUAD8);
00085   aGeomFACESet.insert(eQUAD9);
00086   aGeomFACESet.insert(ePOLYGONE);
00087 
00088   TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE];
00089   aGeomMAILLESet.insert(ePOINT1);
00090   aGeomMAILLESet.insert(aGeomARETESet.begin(),aGeomARETESet.end());
00091   aGeomMAILLESet.insert(aGeomFACESet.begin(),aGeomFACESet.end());
00092   aGeomMAILLESet.insert(eTETRA4);
00093   aGeomMAILLESet.insert(ePYRA5);
00094   aGeomMAILLESet.insert(ePENTA6);
00095   aGeomMAILLESet.insert(eHEXA8);
00096   aGeomMAILLESet.insert(eOCTA12);
00097   aGeomMAILLESet.insert(eTETRA10);
00098   aGeomMAILLESet.insert(ePYRA13);
00099   aGeomMAILLESet.insert(ePENTA15);
00100   aGeomMAILLESet.insert(eHEXA20);
00101   aGeomMAILLESet.insert(eHEXA27);
00102   aGeomMAILLESet.insert(ePOLYEDRE);
00103   
00104   return true;
00105 }
00106 
00107 static bool anIsInited = InitEntity2GeomSet();
00108 
00109 const MED::TEntity2GeomSet& MED::GetEntity2GeomSet()
00110 {
00111   return Entity2GeomSet;
00112 }
00113 
00114