1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #include "MEDCouplingField.hxx"
22 #include "MEDCouplingMesh.hxx"
23 #include "MEDCouplingFieldDiscretization.hxx"
27 using namespace ParaMEDMEM;
29 bool MEDCouplingField::isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const
32 throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualIfNotWhy : other instance is NULL !");
33 std::ostringstream oss; oss.precision(15);
34 if(_name!=other->_name)
36 oss << "Field names differ : this name = \"" << _name << "\" and other name = \"" << other->_name << "\" !";
40 if(_desc!=other->_desc)
42 oss << "Field descriptions differ : this description = \"" << _desc << "\" and other description = \"" << other->_desc << "\" !";
46 if(_nature!=other->_nature)
48 oss << "Field nature differ : this nature = \"" << MEDCouplingNatureOfField::GetRepr(_nature) << "\" and other nature = \"" << MEDCouplingNatureOfField::GetRepr(other->_nature) << "\" !";
52 if(!_type->isEqualIfNotWhy(other->_type,valsPrec,reason))
54 reason.insert(0,"Spatial discretizations differ :");
57 if(_mesh==0 && other->_mesh==0)
59 if(_mesh==0 || other->_mesh==0)
61 reason="Only one field between the two this and other has its underlying mesh defined !";
64 if(_mesh==other->_mesh)
66 bool ret=_mesh->isEqualIfNotWhy(other->_mesh,meshPrec,reason);
68 reason.insert(0,"Underlying meshes of fields differ for the following reason : ");
73 * Checks if \a this and another MEDCouplingField are fully equal.
74 * \param [in] other - the field to compare with \a this one.
75 * \param [in] meshPrec - precision used to compare node coordinates of the underlying mesh.
76 * \param [in] valsPrec - precision used to compare field values.
77 * \return bool - \c true if the two fields are equal, \c false else.
78 * \throw If \a other is NULL.
80 bool MEDCouplingField::isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const
83 return isEqualIfNotWhy(other,meshPrec,valsPrec,tmp);
87 * Checks if \a this and another MEDCouplingField are equal. The textual
88 * information like names etc. is not considered.
89 * \param [in] other - the field to compare with \a this one.
90 * \param [in] meshPrec - precision used to compare node coordinates of the underlying mesh.
91 * \param [in] valsPrec - precision used to compare field values.
92 * \return bool - \c true if the two fields are equal, \c false else.
93 * \throw If \a other is NULL.
94 * \throw If the spatial discretization of \a this field is NULL.
96 bool MEDCouplingField::isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const
99 throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : input field is NULL !");
101 throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : spatial discretization of this is NULL !");
102 if(!_type->isEqualWithoutConsideringStr(other->_type,valsPrec))
104 if(_nature!=other->_nature)
106 if(_mesh==0 && other->_mesh==0)
108 if(_mesh==0 || other->_mesh==0)
110 if(_mesh==other->_mesh)
112 return _mesh->isEqualWithoutConsideringStr(other->_mesh,meshPrec);
116 * This method states if 'this' and 'other' are compatibles each other before performing any treatment.
117 * This method is good for methods like : mergeFields.
118 * This method is not very demanding compared to areStrictlyCompatible that is better for operation on fields.
120 bool MEDCouplingField::areCompatibleForMerge(const MEDCouplingField *other) const
123 throw INTERP_KERNEL::Exception("MEDCouplingField::areCompatibleForMerge : input field is NULL !");
124 if(!_type->isEqual(other->_type,1.))
126 if(_nature!=other->_nature)
128 if(_mesh==other->_mesh)
130 return _mesh->areCompatibleForMerge(other->_mesh);
134 * This method is more strict than MEDCouplingField::areCompatibleForMerge method.
135 * This method is used for operation on fields to operate a first check before attempting operation.
137 bool MEDCouplingField::areStrictlyCompatible(const MEDCouplingField *other) const
140 throw INTERP_KERNEL::Exception("MEDCouplingField::areStrictlyCompatible : input field is NULL !");
141 if(!_type->isEqual(other->_type,1.e-12))
143 if(_nature!=other->_nature)
145 return _mesh==other->_mesh;
148 void MEDCouplingField::updateTime() const
151 updateTimeWith(*_mesh);
153 updateTimeWith(*_type);
156 std::size_t MEDCouplingField::getHeapMemorySizeWithoutChildren() const
159 ret+=_name.capacity();
160 ret+=_desc.capacity();
164 std::vector<const BigMemoryObject *> MEDCouplingField::getDirectChildren() const
166 std::vector<const BigMemoryObject *> ret;
168 ret.push_back(_mesh);
169 if((const MEDCouplingFieldDiscretization *)_type)
170 ret.push_back((const MEDCouplingFieldDiscretization *)_type);
175 * Returns a type of \ref MEDCouplingSpatialDisc "spatial discretization" of \a this
176 * field in terms of enum ParaMEDMEM::TypeOfField.
177 * \return ParaMEDMEM::TypeOfField - the type of \a this field.
178 * \throw If the geometric type is empty.
180 TypeOfField MEDCouplingField::getTypeOfField() const
182 if(!((const MEDCouplingFieldDiscretization *)_type))
183 throw INTERP_KERNEL::Exception("MEDCouplingField::getTypeOfField : spatial discretization is null !");
184 return _type->getEnum();
188 * Returns the nature of \a this field. This information is very important during
189 * interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC.
190 * In other context than the two mentioned above, this attribute is unimportant. This
191 * attribute is not stored in the MED file.
192 * For more information of the semantics and the influence of this attribute to the
193 * result of interpolation, see
194 * - \ref NatureOfField
195 * - \ref TableNatureOfField "How interpolation coefficients depend on Field Nature"
197 NatureOfField MEDCouplingField::getNature() const
203 * Sets the nature of \a this field. This information is very important during
204 * interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC.
205 * In other context than the two mentioned above, this attribute is unimportant. This
206 * attribute is not stored in the MED file.
207 * For more information of the semantics and the influence of this attribute to the
208 * result of interpolation, see
209 * - \ref NatureOfField
210 * - \ref TableNatureOfField "How interpolation coefficients depend on Field Nature"
212 * \param [in] nat - the nature of \a this field.
213 * \throw If \a nat has an invalid value.
215 void MEDCouplingField::setNature(NatureOfField nat)
217 MEDCouplingNatureOfField::GetRepr(nat);//generate a throw if nat not recognized
222 * Returns coordinates of field location points that depend on
223 * \ref MEDCouplingSpatialDisc "spatial discretization" of \a this field.
224 * - For a field on nodes, returns coordinates of nodes.
225 * - For a field on cells, returns barycenters of cells.
226 * - For a field on gauss points, returns coordinates of gauss points.
228 * \return DataArrayDouble * - a new instance of DataArrayDouble. The caller is to
229 * delete this array using decrRef() as it is no more needed.
230 * \throw If the spatial discretization of \a this field is NULL.
231 * \throw If the mesh is not set.
233 DataArrayDouble *MEDCouplingField::getLocalizationOfDiscr() const
236 throw INTERP_KERNEL::Exception("MEDCouplingField::getLocalizationOfDiscr : No mesh set !");
237 if(!((const MEDCouplingFieldDiscretization *)_type))
238 throw INTERP_KERNEL::Exception("MEDCouplingField::getLocalizationOfDiscr : No spatial discretization set !");
239 return _type->getLocalizationOfDiscValues(_mesh);
243 * Returns a new MEDCouplingFieldDouble containing volumes of cells of a dual mesh whose
244 * cells are constructed around field location points (getLocalizationOfDiscr()) of \a this
245 * field. (In case of a field on cells, the dual mesh coincides with the underlying mesh).<br>
246 * For 1D cells, the returned field contains lengths.<br>
247 * For 2D cells, the returned field contains areas.<br>
248 * For 3D cells, the returned field contains volumes.
249 * \param [in] isAbs - if \c true, the computed cell volume does not reflect cell
250 * orientation, i.e. the volume is always positive.
251 * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble.
252 * The caller is to delete this array using decrRef() as
253 * it is no more needed.
254 * \throw If the mesh is not set.
255 * \throw If the spatial discretization of \a this field is NULL.
256 * \throw If the spatial discretization of \a this field is not well defined.
259 MEDCouplingFieldDouble *MEDCouplingField::buildMeasureField(bool isAbs) const
262 throw INTERP_KERNEL::Exception("MEDCouplingField::buildMeasureField : no mesh defined !");
263 if(!((const MEDCouplingFieldDiscretization *)_type))
264 throw INTERP_KERNEL::Exception("MEDCouplingField::buildMeasureField : No spatial discretization set !");
265 return _type->getMeasureField(_mesh,isAbs);
269 * Sets the underlying mesh of \a this field.
270 * For examples of field construction, see \ref MEDCouplingFirstSteps3.
271 * \param [in] mesh - the new underlying mesh.
273 void MEDCouplingField::setMesh(const MEDCouplingMesh *mesh)
284 updateTimeWith(*_mesh);
290 * Sets localization of Gauss points for a given geometric type of cell.
291 * \param [in] type - the geometric type of cell for which the Gauss localization is set.
292 * \param [in] refCoo - coordinates of points of the reference cell. Size of this vector
293 * must be \c nbOfNodesPerCell * \c dimOfType.
294 * \param [in] gsCoo - coordinates of Gauss points on the reference cell. Size of this vector
295 * must be _wg_.size() * \c dimOfType.
296 * \param [in] wg - the weights of Gauss points.
297 * \throw If \a this field is not on Gauss points.
298 * \throw If the spatial discretization of \a this field is NULL.
299 * \throw If the mesh is not set.
300 * \throw If size of any vector do not match the \a type.
302 void MEDCouplingField::setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
303 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
306 throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnType method !");
307 if(!((const MEDCouplingFieldDiscretization *)_type))
308 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call setGaussLocalizationOnType method !");
309 _type->setGaussLocalizationOnType(_mesh,type,refCoo,gsCoo,wg);
313 * Sets localization of Gauss points for given cells specified by their ids.
314 * \param [in] begin - an array of cell ids of interest.
315 * \param [in] end - the end of \a begin, i.e. a pointer to its (last+1)-th element.
316 * \param [in] refCoo - coordinates of points of the reference cell. Size of this vector
317 * must be \c nbOfNodesPerCell * \c dimOfType.
318 * \param [in] gsCoo - coordinates of Gauss points on the reference cell. Size of this vector
319 * must be _wg_.size() * \c dimOfType.
320 * \param [in] wg - the weights of Gauss points.
321 * \throw If \a this field is not on Gauss points.
322 * \throw If the spatial discretization of \a this field is NULL.
323 * \throw If the mesh is not set.
324 * \throw If size of any vector do not match the type of cell # \a begin[0].
325 * \throw If type of any cell in \a begin differs from that of cell # \a begin[0].
326 * \throw If the range [_begin_,_end_) is empty.
328 void MEDCouplingField::setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
329 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
332 throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnCells method !");
333 if(!((const MEDCouplingFieldDiscretization *)_type))
334 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call setGaussLocalizationOnCells method !");
335 _type->setGaussLocalizationOnCells(_mesh,begin,end,refCoo,gsCoo,wg);
339 * Clears data on Gauss points localization.
340 * \throw If \a this field is not on Gauss points.
341 * \throw If the spatial discretization of \a this field is NULL.
343 void MEDCouplingField::clearGaussLocalizations()
345 if(!((const MEDCouplingFieldDiscretization *)_type))
346 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call clearGaussLocalizations method !");
347 _type->clearGaussLocalizations();
351 * Returns a reference to the Gauss localization object by its id.
352 * \warning This method is not const, so the returned object can be modified without any
354 * \param [in] locId - the id of the Gauss localization object of interest.
355 * It must be in range <em> 0 <= locId < getNbOfGaussLocalization() </em>.
356 * \return \ref MEDCouplingGaussLocalization & - the Gauss localization object.
357 * \throw If \a this field is not on Gauss points.
358 * \throw If \a locId is not within the valid range.
359 * \throw If the spatial discretization of \a this field is NULL.
361 MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId)
363 if(!((const MEDCouplingFieldDiscretization *)_type))
364 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
365 return _type->getGaussLocalization(locId);
369 * Returns an id of the Gauss localization object corresponding to a given cell type.
370 * \param [in] type - the cell type of interest.
371 * \return int - the id of the Gauss localization object.
372 * \throw If \a this field is not on Gauss points.
373 * \throw If the spatial discretization of \a this field is NULL.
374 * \throw If no Gauss localization object found for the given cell \a type.
375 * \throw If more than one Gauss localization object found for the given cell \a type.
377 int MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
379 if(!((const MEDCouplingFieldDiscretization *)_type))
380 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneType method !");
381 return _type->getGaussLocalizationIdOfOneType(type);
385 * Returns ids of Gauss localization objects corresponding to a given cell type.
386 * \param [in] type - the cell type of interest.
387 * \return std::set<int> - ids of the Gauss localization object.
388 * \throw If \a this field is not on Gauss points.
389 * \throw If the spatial discretization of \a this field is NULL
391 std::set<int> MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
393 if(!((const MEDCouplingFieldDiscretization *)_type))
394 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdsOfOneType method !");
395 return _type->getGaussLocalizationIdsOfOneType(type);
399 * Returns number of Gauss localization objects available. Implicitly all ids in
400 * [0,getNbOfGaussLocalization()) are valid Gauss localization ids.
401 * \return int - the number of available Gauss localization objects.
402 * \throw If \a this field is not on Gauss points.
403 * \throw If the spatial discretization of \a this field is NULL.
405 int MEDCouplingField::getNbOfGaussLocalization() const
407 if(!((const MEDCouplingFieldDiscretization *)_type))
408 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNbOfGaussLocalization method !");
409 return _type->getNbOfGaussLocalization();
413 * Returns an id of the Gauss localization object corresponding to a type of a given cell.
414 * \param [in] cellId - an id of the cell of interest.
415 * \return int - the id of the Gauss localization object.
416 * \throw If \a this field is not on Gauss points.
417 * \throw If the spatial discretization of \a this field is NULL.
418 * \throw If no Gauss localization object found for the given cell.
420 int MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const
422 if(!((const MEDCouplingFieldDiscretization *)_type))
423 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneCell method !");
424 return _type->getGaussLocalizationIdOfOneCell(cellId);
428 * Returns ids of cells that share the same Gauss localization given by its id.
429 * \param [in] locId - the id of the Gauss localization object of interest.
430 * It must be in range <em> 0 <= locId < getNbOfGaussLocalization() </em>.
431 * \param [in,out] cellIds - a vector returning ids of found cells. It is cleared before
432 * filling in. It remains empty if no cells found.
433 * \throw If \a this field is not on Gauss points.
434 * \throw If \a locId is not within the valid range.
435 * \throw If the spatial discretization of \a this field is NULL.
437 void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const
440 if(!((const MEDCouplingFieldDiscretization *)_type))
441 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getCellIdsHavingGaussLocalization method !");
442 _type->getCellIdsHavingGaussLocalization(locId,cellIds);
446 * Returns a reference to the Gauss localization object by its id.
447 * \warning This method is const, so the returned object is not apt for modification.
448 * \param [in] locId - the id of the Gauss localization object of interest.
449 * It must be in range <em> 0 <= locId < getNbOfGaussLocalization() </em>.
450 * \return \ref const MEDCouplingGaussLocalization & - the Gauss localization object.
451 * \throw If \a this field is not on Gauss points.
452 * \throw If \a locId is not within the valid range.
453 * \throw If the spatial discretization of \a this field is NULL.
455 const MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId) const
457 if(!((const MEDCouplingFieldDiscretization *)_type))
458 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
459 return _type->getGaussLocalization(locId);
462 MEDCouplingField::~MEDCouplingField()
468 MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature):_nature(nature),_mesh(0),_type(type)
472 MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(0),_type(MEDCouplingFieldDiscretization::New(type))
476 MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy):RefCountObject(other),_name(other._name),_desc(other._desc),_nature(other._nature),
485 _type=other._type->clone();
491 * Returns a new MEDCouplingMesh constituted by some cells of the underlying mesh of \a
492 * this filed, and returns ids of entities (nodes, cells, Gauss points) lying on the
493 * specified cells. The cells to include to the result mesh are specified by an array of
494 * cell ids. The new mesh shares the coordinates array with the underlying mesh.
495 * \param [in] start - an array of cell ids to include to the result mesh.
496 * \param [in] end - specifies the end of the array \a start, so that
497 * the last value of \a start is \a end[ -1 ].
498 * \param [out] di - a new instance of DataArrayInt holding the ids of entities (nodes,
499 * cells, Gauss points). The caller is to delete this array using decrRef() as it
501 * \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to
502 * delete this mesh using decrRef() as it is no more needed.
503 * \throw If the spatial discretization of \a this field is NULL.
504 * \throw If the mesh is not set.
505 * \sa buildSubMeshDataRange()
507 MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const
509 if(!((const MEDCouplingFieldDiscretization *)_type))
510 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshData method !");
511 return _type->buildSubMeshData(_mesh,start,end,di);
515 * This method returns a submesh of 'mesh' instance constituting cell ids defined by a range given by the 3 following inputs \a begin, \a end and \a step.
517 * \param [out] beginOut Valid only if \a di is NULL
518 * \param [out] endOut Valid only if \a di is NULL
519 * \param [out] stepOut Valid only if \a di is NULL
520 * \param [out] di is an array returned that specifies entity ids (nodes, cells, Gauss points... ) in array if no output range is foundable.
522 * \sa MEDCouplingField::buildSubMeshData
524 MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(int begin, int end, int step, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
526 if(!((const MEDCouplingFieldDiscretization *)_type))
527 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshDataRange method !");
528 return _type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,di);
532 * This method returns tuples ids implied by the mesh selection of the cell ids contained in array defined as an interval [start;end).
533 * \return a newly allocated DataArrayInt instance containing tuples ids.
535 DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const
537 if(!((const MEDCouplingFieldDiscretization *)_type))
538 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call computeTupleIdsToSelectFromCellIds method !");
539 return _type->computeTupleIdsToSelectFromCellIds(_mesh,startCellIds,endCellIds);
543 * Returns number of tuples expected regarding the spatial discretization of \a this
544 * field and number of entities in the underlying mesh.
545 * \return int - the number of expected tuples.
546 * \throw If the spatial discretization of \a this field is NULL.
547 * \throw If the mesh is not set.
549 int MEDCouplingField::getNumberOfTuplesExpected() const
551 if(!((const MEDCouplingFieldDiscretization *)_type))
552 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfTuplesExpected method !");
554 return _type->getNumberOfTuples(_mesh);
556 throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfTuplesExpected : Empty mesh !");
559 void MEDCouplingField::setDiscretization(MEDCouplingFieldDiscretization *newDisc)
561 bool needUpdate=(const MEDCouplingFieldDiscretization *)_type!=newDisc;
570 * Returns number of mesh entities in the underlying mesh of \a this field regarding the
571 * spatial discretization.
572 * \return int - the number of mesh entities porting the field values.
573 * \throw If the spatial discretization of \a this field is NULL.
574 * \throw If the mesh is not set.
576 int MEDCouplingField::getNumberOfMeshPlacesExpected() const
578 if(!((const MEDCouplingFieldDiscretization *)_type))
579 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfMeshPlacesExpected method !");
581 return _type->getNumberOfMeshPlaces(_mesh);
583 throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfMeshPlacesExpected : Empty mesh !");
587 * Copy tiny info (component names, name, description) but warning the underlying mesh is not renamed (for safety reason).
589 void MEDCouplingField::copyTinyStringsFrom(const MEDCouplingField *other)
593 setName(other->_name.c_str());
594 setDescription(other->_desc.c_str());
599 * This method computes the number of tuples a DataArrayDouble instance should have to build a correct MEDCouplingFieldDouble instance starting from a
600 * submesh of a virtual mesh on which a substraction per type had been applied regarding the spatial discretization in \a this.
602 * For spatial discretization \b not equal to ON_GAUSS_NE this method will make the hypothesis that any positive entity id in \a code \a idsPerType is valid.
603 * So in those cases attribute \a _mesh of \a this is ignored.
605 * For spatial discretization equal to ON_GAUSS_NE \a _mesh attribute will be taken into account.
607 * The input code is those implemented in MEDCouplingUMesh::splitProfilePerType.
609 * \param [in] code - a code with format described above.
610 * \param [in] idsPerType - a list of subparts
611 * \throw If \a this has no spatial discretization set.
612 * \throw If input code point to invalid zones in spatial discretization.
613 * \throw If spatial discretization in \a this requires a mesh and those mesh is invalid (null,...)
615 int MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
617 const MEDCouplingFieldDiscretization *t(_type);
619 throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfTuplesExpectedRegardingCode : no spatial discretization set !");
620 return t->getNumberOfTuplesExpectedRegardingCode(code,idsPerType);