Salome HOME
Merge from MrgToV7main1804
[modules/med.git] / src / MEDCoupling / MEDCouplingGaussLocalization.cxx
index eae9beab48a823397d28176d7da4836808c06668..5906ffc8b391b4c16de184378dfc59fba2208b1e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2013  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
@@ -16,6 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
 
 #include "MEDCouplingGaussLocalization.hxx"
 #include "CellModel.hxx"
@@ -41,6 +42,23 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
+ParaMEDMEM::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception)
+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) throw(INTERP_KERNEL::Exception)
+{
+  INTERP_KERNEL::CellModel::GetCellModel(typ);//throws if not found. This is a check
+  _type=typ;
+}
+
 void ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherency() const throw(INTERP_KERNEL::Exception)
 {
   const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
@@ -86,6 +104,15 @@ std::string ParaMEDMEM::MEDCouplingGaussLocalization::getStringRepr() const
   return oss.str();
 }
 
+std::size_t ParaMEDMEM::MEDCouplingGaussLocalization::getHeapMemorySize() const
+{
+  std::size_t ret=0;
+  ret+=_ref_coord.capacity()*sizeof(double);
+  ret+=_gauss_coord.capacity()*sizeof(double);
+  ret+=_weight.capacity()*sizeof(double);
+  return ret;
+}
+
 bool ParaMEDMEM::MEDCouplingGaussLocalization::isEqual(const MEDCouplingGaussLocalization& other, double eps) const
 {
   if(_type!=other._type)
@@ -193,6 +220,21 @@ void ParaMEDMEM::MEDCouplingGaussLocalization::setWeight(int gaussPtIdInCell, do
   _weight[gaussPtIdInCell]=newVal;
 }
 
+void ParaMEDMEM::MEDCouplingGaussLocalization::setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception)
+{
+  _ref_coord=refCoo;
+}
+
+void ParaMEDMEM::MEDCouplingGaussLocalization::setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception)
+{
+  _gauss_coord=gsCoo;
+}
+
+void ParaMEDMEM::MEDCouplingGaussLocalization::setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception)
+{
+  _weight=w;
+}
+
 /*!
  * The format of 'tinyData' parameter is the same than pushed in method ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo.
  */