Salome HOME
DGTUMesh with no cells can be now converted into umesh
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingGaussLocalization.cxx
index 6160b79164d2d86639a343def5d624772921694a..e364a64bbd93fd7c65eedc29ba5acc985b83c9d3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
 #include <iterator>
 #include <algorithm>
 
-ParaMEDMEM::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
-                                                                       const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception)
+MEDCoupling::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
+                                                                       const std::vector<double>& gsCoo, const std::vector<double>& w)
 try:_type(type),_ref_coord(refCoo),_gauss_coord(gsCoo),_weight(w)
-  {
-    checkCoherency();
-  }
+{
+  checkConsistencyLight();
+}
 catch(INTERP_KERNEL::Exception& e)
-  {
+{
     _type=INTERP_KERNEL::NORM_ERROR;
     _ref_coord.clear();
     _gauss_coord.clear();
     _weight.clear();
     throw e;
-  }
+}
 
-ParaMEDMEM::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ)
+MEDCoupling::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ)
 try:_type(typ)
 {
   INTERP_KERNEL::CellModel::GetCellModel(_type);
 }
 catch(INTERP_KERNEL::Exception& e)
-  {
+{
     _type=INTERP_KERNEL::NORM_ERROR;
     throw e;
-  }
+}
 
-void ParaMEDMEM::MEDCouplingGaussLocalization::setType(INTERP_KERNEL::NormalizedCellType typ)
+void MEDCoupling::MEDCouplingGaussLocalization::setType(INTERP_KERNEL::NormalizedCellType typ)
 {
   INTERP_KERNEL::CellModel::GetCellModel(typ);//throws if not found. This is a check
   _type=typ;
 }
 
-void ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherency() const
+void MEDCoupling::MEDCouplingGaussLocalization::checkConsistencyLight() const
 {
   const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
   int nbNodes=cm.getNumberOfNodes();
@@ -74,19 +74,19 @@ void ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherency() const
     }
   if(_gauss_coord.size()!=dim*_weight.size())
     {
-       std::ostringstream oss; oss << "Invalid gsCoo size and weight size : gsCoo.size() must be equal to _weight.size() * " << dim << " (dim) !";
-       throw INTERP_KERNEL::Exception(oss.str().c_str());
+      std::ostringstream oss; oss << "Invalid gsCoo size and weight size : gsCoo.size() must be equal to _weight.size() * " << dim << " (dim) !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
 }
 
-int ParaMEDMEM::MEDCouplingGaussLocalization::getDimension() const
+int MEDCoupling::MEDCouplingGaussLocalization::getDimension() const
 {
   if(_weight.empty())
     return -1;
   return (int)_gauss_coord.size()/(int)_weight.size();
 }
 
-int ParaMEDMEM::MEDCouplingGaussLocalization::getNumberOfPtsInRefCell() const
+int MEDCoupling::MEDCouplingGaussLocalization::getNumberOfPtsInRefCell() const
 {
   int dim=getDimension();
   if(dim==0)
@@ -94,7 +94,7 @@ int ParaMEDMEM::MEDCouplingGaussLocalization::getNumberOfPtsInRefCell() const
   return (int)_ref_coord.size()/dim;
 }
 
-std::string ParaMEDMEM::MEDCouplingGaussLocalization::getStringRepr() const
+std::string MEDCoupling::MEDCouplingGaussLocalization::getStringRepr() const
 {
   std::ostringstream oss;
   oss << "CellType : " << INTERP_KERNEL::CellModel::GetCellModel(_type).getRepr() << std::endl;
@@ -104,7 +104,7 @@ std::string ParaMEDMEM::MEDCouplingGaussLocalization::getStringRepr() const
   return oss.str();
 }
 
-std::size_t ParaMEDMEM::MEDCouplingGaussLocalization::getMemorySize() const
+std::size_t MEDCoupling::MEDCouplingGaussLocalization::getMemorySize() const
 {
   std::size_t ret=0;
   ret+=_ref_coord.capacity()*sizeof(double);
@@ -113,7 +113,7 @@ std::size_t ParaMEDMEM::MEDCouplingGaussLocalization::getMemorySize() const
   return ret;
 }
 
-bool ParaMEDMEM::MEDCouplingGaussLocalization::isEqual(const MEDCouplingGaussLocalization& other, double eps) const
+bool MEDCoupling::MEDCouplingGaussLocalization::isEqual(const MEDCouplingGaussLocalization& other, double eps) const
 {
   if(_type!=other._type)
     return false;
@@ -126,7 +126,7 @@ bool ParaMEDMEM::MEDCouplingGaussLocalization::isEqual(const MEDCouplingGaussLoc
   return true;
 }
 
-double ParaMEDMEM::MEDCouplingGaussLocalization::getRefCoord(int ptIdInCell, int comp) const
+double MEDCoupling::MEDCouplingGaussLocalization::getRefCoord(int ptIdInCell, int comp) const
 {
   const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
   int nbNodes=cm.getNumberOfNodes();
@@ -138,13 +138,13 @@ double ParaMEDMEM::MEDCouplingGaussLocalization::getRefCoord(int ptIdInCell, int
   return _ref_coord[ptIdInCell*dim+comp];
 }
 
-double ParaMEDMEM::MEDCouplingGaussLocalization::getGaussCoord(int gaussPtIdInCell, int comp) const
+double MEDCoupling::MEDCouplingGaussLocalization::getGaussCoord(int gaussPtIdInCell, int comp) const
 {
   int dim=checkCoherencyOfRequest(gaussPtIdInCell,comp);
   return _gauss_coord[gaussPtIdInCell*dim+comp];
 }
 
-double ParaMEDMEM::MEDCouplingGaussLocalization::getWeight(int gaussPtIdInCell, double newVal) const
+double MEDCoupling::MEDCouplingGaussLocalization::getWeight(int gaussPtIdInCell, double newVal) const
 {
   checkCoherencyOfRequest(gaussPtIdInCell,0);
   return _weight[gaussPtIdInCell];
@@ -155,7 +155,7 @@ double ParaMEDMEM::MEDCouplingGaussLocalization::getWeight(int gaussPtIdInCell,
  * push at the end of tinyInfo its basic serialization info. The size of pushed data is always the same.
  * @param tinyInfo inout parameter.
  */
-void ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std::vector<int>& tinyInfo) const
+void MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std::vector<int>& tinyInfo) const
 {
   tinyInfo.push_back((int)_type);
   tinyInfo.push_back(getNumberOfPtsInRefCell());
@@ -167,7 +167,7 @@ void ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std:
  * push at the end of tinyInfo its basic serialization info. The size of pushed data is \b NOT always the same contrary to pushTinySerializationIntInfo.
  * @param tinyInfo inout parameter.
  */
-void ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo(std::vector<double>& tinyInfo) const
+void MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo(std::vector<double>& tinyInfo) const
 {
   tinyInfo.insert(tinyInfo.end(),_ref_coord.begin(),_ref_coord.end());
   tinyInfo.insert(tinyInfo.end(),_gauss_coord.begin(),_gauss_coord.end());
@@ -175,12 +175,12 @@ void ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo(std:
 }
 
 /*!
- * This method operates the exact inverse operation than ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo method. This is one of the last step of unserialization process.
+ * This method operates the exact inverse operation than MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo method. This is one of the last step of unserialization process.
  * This method should be called on an object resized by buildNewInstanceFromTinyInfo static method.
  * This method takes in argument a pointer 'vals' that point to the begin of double data pushed remotely by pushTinySerializationDblInfo method.
  * This method returns the pointer 'vals' with an offset of size what it has been read in this method.
  */
-const double *ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues(const double *vals)
+const double *MEDCoupling::MEDCouplingGaussLocalization::fillWithValues(const double *vals)
 {
   const double *work=vals;
   std::copy(work,work+_ref_coord.size(),_ref_coord.begin());
@@ -196,7 +196,7 @@ const double *ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues(const dou
  * This method sets the comp_th component of ptIdInCell_th point coordinate of reference element of type this->_type.
  * @throw if not 0<=ptIdInCell<nbOfNodePerCell or if not 0<=comp<dim
  */
-void ParaMEDMEM::MEDCouplingGaussLocalization::setRefCoord(int ptIdInCell, int comp, double newVal)
+void MEDCoupling::MEDCouplingGaussLocalization::setRefCoord(int ptIdInCell, int comp, double newVal)
 {
   const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
   int nbNodes=cm.getNumberOfNodes();
@@ -208,43 +208,43 @@ void ParaMEDMEM::MEDCouplingGaussLocalization::setRefCoord(int ptIdInCell, int c
   _ref_coord[ptIdInCell*dim+comp]=newVal;
 }
 
-void ParaMEDMEM::MEDCouplingGaussLocalization::setGaussCoord(int gaussPtIdInCell, int comp, double newVal)
+void MEDCoupling::MEDCouplingGaussLocalization::setGaussCoord(int gaussPtIdInCell, int comp, double newVal)
 {
   int dim=checkCoherencyOfRequest(gaussPtIdInCell,comp);
   _gauss_coord[gaussPtIdInCell*dim+comp]=newVal;
 }
 
-void ParaMEDMEM::MEDCouplingGaussLocalization::setWeight(int gaussPtIdInCell, double newVal)
+void MEDCoupling::MEDCouplingGaussLocalization::setWeight(int gaussPtIdInCell, double newVal)
 {
   checkCoherencyOfRequest(gaussPtIdInCell,0);
   _weight[gaussPtIdInCell]=newVal;
 }
 
-void ParaMEDMEM::MEDCouplingGaussLocalization::setRefCoords(const std::vector<double>& refCoo)
+void MEDCoupling::MEDCouplingGaussLocalization::setRefCoords(const std::vector<double>& refCoo)
 {
   _ref_coord=refCoo;
 }
 
-void ParaMEDMEM::MEDCouplingGaussLocalization::setGaussCoords(const std::vector<double>& gsCoo)
+void MEDCoupling::MEDCouplingGaussLocalization::setGaussCoords(const std::vector<double>& gsCoo)
 {
   _gauss_coord=gsCoo;
 }
 
-void ParaMEDMEM::MEDCouplingGaussLocalization::setWeights(const std::vector<double>& w)
+void MEDCoupling::MEDCouplingGaussLocalization::setWeights(const std::vector<double>& w)
 {
   _weight=w;
 }
 
 /*!
- * The format of 'tinyData' parameter is the same than pushed in method ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo.
+ * The format of 'tinyData' parameter is the same than pushed in method MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo.
  */
-ParaMEDMEM::MEDCouplingGaussLocalization ParaMEDMEM::MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData)
+MEDCoupling::MEDCouplingGaussLocalization MEDCoupling::MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData)
 {
   std::vector<double> v1(dim*tinyData[1]),v2(dim*tinyData[2]),v3(tinyData[2]);
-  return ParaMEDMEM::MEDCouplingGaussLocalization((INTERP_KERNEL::NormalizedCellType)tinyData[0],v1,v2,v3);
+  return MEDCoupling::MEDCouplingGaussLocalization((INTERP_KERNEL::NormalizedCellType)tinyData[0],v1,v2,v3);
 }
 
-int ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const
+int MEDCoupling::MEDCouplingGaussLocalization::checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const
 {
   const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
   int dim=cm.getDimension();
@@ -256,7 +256,7 @@ int ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherencyOfRequest(int gaussP
   return dim;
 }
 
-bool ParaMEDMEM::MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps)
+bool MEDCoupling::MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps)
 {
   std::size_t sz=v1.size();
   if(sz!=v2.size())