1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 MEDCoupling;
29 void MEDCouplingField::checkConsistencyLight() const
32 throw INTERP_KERNEL::Exception("Field invalid because no mesh specified !");
34 throw INTERP_KERNEL::Exception("MEDCouplingField::checkConsistencyLight : no spatial discretization !");
37 bool MEDCouplingField::isEqualIfNotWhyProtected(const MEDCouplingField *other, double meshPrec, std::string& reason) const
40 throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualIfNotWhy : other instance is NULL !");
41 std::ostringstream oss; oss.precision(15);
42 if(_name!=other->_name)
44 oss << "Field names differ : this name = \"" << _name << "\" and other name = \"" << other->_name << "\" !";
48 if(_desc!=other->_desc)
50 oss << "Field descriptions differ : this description = \"" << _desc << "\" and other description = \"" << other->_desc << "\" !";
54 if(_nature!=other->_nature)
56 oss << "Field nature differ : this nature = \"" << MEDCouplingNatureOfField::GetRepr(_nature) << "\" and other nature = \"" << MEDCouplingNatureOfField::GetRepr(other->_nature) << "\" !";
60 if(!_type->isEqualIfNotWhy(other->_type,meshPrec,reason))
62 reason.insert(0,"Spatial discretizations differ :");
65 if(_mesh==0 && other->_mesh==0)
67 if(_mesh==0 || other->_mesh==0)
69 reason="Only one field between the two this and other has its underlying mesh defined !";
72 if(_mesh==other->_mesh)
74 bool ret=_mesh->isEqualIfNotWhy(other->_mesh,meshPrec,reason);
76 reason.insert(0,"Underlying meshes of fields differ for the following reason : ");
81 * Checks if \a this and another MEDCouplingField are equal. The textual
82 * information like names etc. is not considered.
83 * \param [in] other - the field to compare with \a this one.
84 * \param [in] meshPrec - precision used to compare node coordinates of the underlying mesh.
85 * \return bool - \c true if the two fields are equal, \c false else.
86 * \throw If \a other is NULL.
87 * \throw If the spatial discretization of \a this field is NULL.
89 bool MEDCouplingField::isEqualWithoutConsideringStrProtected(const MEDCouplingField *other, double meshPrec) const
92 throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : input field is NULL !");
94 throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : spatial discretization of this is NULL !");
95 if(!_type->isEqualWithoutConsideringStr(other->_type,meshPrec))
97 if(_nature!=other->_nature)
99 if(_mesh==0 && other->_mesh==0)
101 if(_mesh==0 || other->_mesh==0)
103 if(_mesh==other->_mesh)
105 return _mesh->isEqualWithoutConsideringStr(other->_mesh,meshPrec);
109 * This method states if 'this' and 'other' are compatibles each other before performing any treatment.
110 * This method is good for methods like : mergeFields.
111 * This method is not very demanding compared to areStrictlyCompatible that is better for operation on fields.
113 bool MEDCouplingField::areCompatibleForMerge(const MEDCouplingField *other) const
116 throw INTERP_KERNEL::Exception("MEDCouplingField::areCompatibleForMerge : input field is NULL !");
117 if(!_type->isEqual(other->_type,1.))
119 if(_nature!=other->_nature)
121 if(_mesh==other->_mesh)
123 return _mesh->areCompatibleForMerge(other->_mesh);
127 * This method is more strict than MEDCouplingField::areCompatibleForMerge method.
128 * This method is used for operation on fields to operate a first check before attempting operation.
130 bool MEDCouplingField::areStrictlyCompatible(const MEDCouplingField *other) const
133 throw INTERP_KERNEL::Exception("MEDCouplingField::areStrictlyCompatible : input field is NULL !");
134 if(!_type->isEqual(other->_type,1.e-12))
136 if(_nature!=other->_nature)
138 return _mesh==other->_mesh;
142 * This method is less strict than MEDCouplingField::areStrictlyCompatible method.
143 * The difference is that the nature is not checked.
144 * This method is used for multiplication and division on fields to operate a first check before attempting operation.
146 bool MEDCouplingField::areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const
149 throw INTERP_KERNEL::Exception("MEDCouplingField::areStrictlyCompatible : input field is NULL !");
150 if(!_type->isEqual(other->_type,1.e-12))
152 return _mesh==other->_mesh;
156 void MEDCouplingField::updateTime() const
159 updateTimeWith(*_mesh);
161 updateTimeWith(*_type);
164 std::size_t MEDCouplingField::getHeapMemorySizeWithoutChildren() const
167 ret+=_name.capacity();
168 ret+=_desc.capacity();
172 std::vector<const BigMemoryObject *> MEDCouplingField::getDirectChildrenWithNull() const
174 std::vector<const BigMemoryObject *> ret;
175 ret.push_back(_mesh);
176 ret.push_back((const MEDCouplingFieldDiscretization *)_type);
181 * Returns a type of \ref MEDCouplingSpatialDisc "spatial discretization" of \a this
182 * field in terms of enum MEDCoupling::TypeOfField.
183 * \return MEDCoupling::TypeOfField - the type of \a this field.
184 * \throw If the geometric type is empty.
186 TypeOfField MEDCouplingField::getTypeOfField() const
188 if(!((const MEDCouplingFieldDiscretization *)_type))
189 throw INTERP_KERNEL::Exception("MEDCouplingField::getTypeOfField : spatial discretization is null !");
190 return _type->getEnum();
194 * Returns the nature of \a this field. This information is very important during
195 * interpolation process using MEDCoupling::MEDCouplingRemapper or MEDCoupling::InterpKernelDEC.
196 * In other context than the two mentioned above, this attribute is unimportant. This
197 * attribute is not stored in the MED file.
198 * For more information of the semantics and the influence of this attribute to the
199 * result of interpolation, see
200 * - \ref NatureOfField
201 * - \ref TableNatureOfField "How interpolation coefficients depend on Field Nature"
203 NatureOfField MEDCouplingField::getNature() const
209 * Sets the nature of \a this field. This information is very important during
210 * interpolation process using MEDCoupling::MEDCouplingRemapper or MEDCoupling::InterpKernelDEC.
211 * In other context than the two mentioned above, this attribute is unimportant. This
212 * attribute is not stored in the MED file.
213 * For more information of the semantics and the influence of this attribute to the
214 * result of interpolation, see
215 * - \ref NatureOfField
216 * - \ref TableNatureOfField "How interpolation coefficients depend on Field Nature"
218 * \param [in] nat - the nature of \a this field.
219 * \throw If \a nat has an invalid value.
221 void MEDCouplingField::setNature(NatureOfField nat)
223 MEDCouplingNatureOfField::GetRepr(nat);//generate a throw if nat not recognized
225 _type->checkCompatibilityWithNature(nat);
230 * Returns coordinates of field location points that depend on
231 * \ref MEDCouplingSpatialDisc "spatial discretization" of \a this field.
232 * - For a field on nodes, returns coordinates of nodes.
233 * - For a field on cells, returns barycenters of cells.
234 * - For a field on gauss points, returns coordinates of gauss points.
236 * \return DataArrayDouble * - a new instance of DataArrayDouble. The caller is to
237 * delete this array using decrRef() as it is no more needed.
238 * \throw If the spatial discretization of \a this field is NULL.
239 * \throw If the mesh is not set.
241 DataArrayDouble *MEDCouplingField::getLocalizationOfDiscr() const
244 throw INTERP_KERNEL::Exception("MEDCouplingField::getLocalizationOfDiscr : No mesh set !");
245 if(!((const MEDCouplingFieldDiscretization *)_type))
246 throw INTERP_KERNEL::Exception("MEDCouplingField::getLocalizationOfDiscr : No spatial discretization set !");
247 return _type->getLocalizationOfDiscValues(_mesh);
251 * Returns a new MEDCouplingFieldDouble containing volumes of cells of a dual mesh whose
252 * cells are constructed around field location points (getLocalizationOfDiscr()) of \a this
253 * field. (In case of a field on cells, the dual mesh coincides with the underlying mesh).<br>
254 * For 1D cells, the returned field contains lengths.<br>
255 * For 2D cells, the returned field contains areas.<br>
256 * For 3D cells, the returned field contains volumes.
257 * \param [in] isAbs - if \c true, the computed cell volume does not reflect cell
258 * orientation, i.e. the volume is always positive.
259 * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble.
260 * The caller is to delete this array using decrRef() as
261 * it is no more needed.
262 * \throw If the mesh is not set.
263 * \throw If the spatial discretization of \a this field is NULL.
264 * \throw If the spatial discretization of \a this field is not well defined.
267 MEDCouplingFieldDouble *MEDCouplingField::buildMeasureField(bool isAbs) const
270 throw INTERP_KERNEL::Exception("MEDCouplingField::buildMeasureField : no mesh defined !");
271 if(!((const MEDCouplingFieldDiscretization *)_type))
272 throw INTERP_KERNEL::Exception("MEDCouplingField::buildMeasureField : No spatial discretization set !");
273 return _type->getMeasureField(_mesh,isAbs);
277 * Sets the underlying mesh of \a this field.
278 * For examples of field construction, see \ref MEDCouplingFirstSteps3.
279 * \param [in] mesh - the new underlying mesh.
281 void MEDCouplingField::setMesh(const MEDCouplingMesh *mesh)
292 updateTimeWith(*_mesh);
298 * Sets localization of Gauss points for a given geometric type of cell.
299 * \param [in] type - the geometric type of cell for which the Gauss localization is set.
300 * \param [in] refCoo - coordinates of points of the reference cell. Size of this vector
301 * must be \c nbOfNodesPerCell * \c dimOfType.
302 * \param [in] gsCoo - coordinates of Gauss points on the reference cell. Size of this vector
303 * must be _wg_.size() * \c dimOfType.
304 * \param [in] wg - the weights of Gauss points.
305 * \throw If \a this field is not on Gauss points.
306 * \throw If the spatial discretization of \a this field is NULL.
307 * \throw If the mesh is not set.
308 * \throw If size of any vector do not match the \a type.
310 void MEDCouplingField::setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
311 const std::vector<double>& gsCoo, const std::vector<double>& wg)
314 throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnType method !");
315 if(!((const MEDCouplingFieldDiscretization *)_type))
316 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call setGaussLocalizationOnType method !");
317 _type->setGaussLocalizationOnType(_mesh,type,refCoo,gsCoo,wg);
321 * Sets localization of Gauss points for given cells specified by their ids.
322 * \param [in] begin - an array of cell ids of interest.
323 * \param [in] end - the end of \a begin, i.e. a pointer to its (last+1)-th element.
324 * \param [in] refCoo - coordinates of points of the reference cell. Size of this vector
325 * must be \c nbOfNodesPerCell * \c dimOfType.
326 * \param [in] gsCoo - coordinates of Gauss points on the reference cell. Size of this vector
327 * must be _wg_.size() * \c dimOfType.
328 * \param [in] wg - the weights of Gauss points.
329 * \throw If \a this field is not on Gauss points.
330 * \throw If the spatial discretization of \a this field is NULL.
331 * \throw If the mesh is not set.
332 * \throw If size of any vector do not match the type of cell # \a begin[0].
333 * \throw If type of any cell in \a begin differs from that of cell # \a begin[0].
334 * \throw If the range [_begin_,_end_) is empty.
336 void MEDCouplingField::setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
337 const std::vector<double>& gsCoo, const std::vector<double>& wg)
340 throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnCells method !");
341 if(!((const MEDCouplingFieldDiscretization *)_type))
342 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call setGaussLocalizationOnCells method !");
343 _type->setGaussLocalizationOnCells(_mesh,begin,end,refCoo,gsCoo,wg);
347 * Clears data on Gauss points localization.
348 * \throw If \a this field is not on Gauss points.
349 * \throw If the spatial discretization of \a this field is NULL.
351 void MEDCouplingField::clearGaussLocalizations()
353 if(!((const MEDCouplingFieldDiscretization *)_type))
354 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call clearGaussLocalizations method !");
355 _type->clearGaussLocalizations();
359 * Returns a reference to the Gauss localization object by its id.
360 * \warning This method is not const, so the returned object can be modified without any
362 * \param [in] locId - the id of the Gauss localization object of interest.
363 * It must be in range <em> 0 <= locId < getNbOfGaussLocalization() </em>.
364 * \return \ref MEDCoupling::MEDCouplingGaussLocalization "MEDCouplingGaussLocalization" & - the
365 * Gauss localization object.
366 * \throw If \a this field is not on Gauss points.
367 * \throw If \a locId is not within the valid range.
368 * \throw If the spatial discretization of \a this field is NULL.
370 MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId)
372 if(!((const MEDCouplingFieldDiscretization *)_type))
373 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
374 return _type->getGaussLocalization(locId);
378 * Returns an id of the Gauss localization object corresponding to a given cell type.
379 * \param [in] type - the cell type of interest.
380 * \return int - the id of the Gauss localization object.
381 * \throw If \a this field is not on Gauss points.
382 * \throw If the spatial discretization of \a this field is NULL.
383 * \throw If no Gauss localization object found for the given cell \a type.
384 * \throw If more than one Gauss localization object found for the given cell \a type.
386 int MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
388 if(!((const MEDCouplingFieldDiscretization *)_type))
389 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneType method !");
390 return _type->getGaussLocalizationIdOfOneType(type);
394 * Returns ids of Gauss localization objects corresponding to a given cell type.
395 * \param [in] type - the cell type of interest.
396 * \return std::set<int> - ids of the Gauss localization object.
397 * \throw If \a this field is not on Gauss points.
398 * \throw If the spatial discretization of \a this field is NULL
400 std::set<int> MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
402 if(!((const MEDCouplingFieldDiscretization *)_type))
403 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdsOfOneType method !");
404 return _type->getGaussLocalizationIdsOfOneType(type);
408 * Returns number of Gauss localization objects available. Implicitly all ids in
409 * [0,getNbOfGaussLocalization()) are valid Gauss localization ids.
410 * \return int - the number of available Gauss localization objects.
411 * \throw If \a this field is not on Gauss points.
412 * \throw If the spatial discretization of \a this field is NULL.
414 int MEDCouplingField::getNbOfGaussLocalization() const
416 if(!((const MEDCouplingFieldDiscretization *)_type))
417 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNbOfGaussLocalization method !");
418 return _type->getNbOfGaussLocalization();
422 * Returns an id of the Gauss localization object corresponding to a type of a given cell.
423 * \param [in] cellId - an id of the cell of interest.
424 * \return int - the id of the Gauss localization object.
425 * \throw If \a this field is not on Gauss points.
426 * \throw If the spatial discretization of \a this field is NULL.
427 * \throw If no Gauss localization object found for the given cell.
429 int MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const
431 if(!((const MEDCouplingFieldDiscretization *)_type))
432 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneCell method !");
433 return _type->getGaussLocalizationIdOfOneCell(cellId);
437 * Returns ids of cells that share the same Gauss localization given by its id.
438 * \param [in] locId - the id of the Gauss localization object of interest.
439 * It must be in range <em> 0 <= locId < getNbOfGaussLocalization() </em>.
440 * \param [in,out] cellIds - a vector returning ids of found cells. It is cleared before
441 * filling in. It remains empty if no cells found.
442 * \throw If \a this field is not on Gauss points.
443 * \throw If \a locId is not within the valid range.
444 * \throw If the spatial discretization of \a this field is NULL.
446 void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const
449 if(!((const MEDCouplingFieldDiscretization *)_type))
450 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getCellIdsHavingGaussLocalization method !");
451 _type->getCellIdsHavingGaussLocalization(locId,cellIds);
455 * Returns a reference to the Gauss localization object by its id.
456 * \warning This method is const, so the returned object is not apt for modification.
457 * \param [in] locId - the id of the Gauss localization object of interest.
458 * It must be in range <em> 0 <= locId < getNbOfGaussLocalization() </em>.
459 * \return const \ref MEDCouplingGaussLocalization & - the Gauss localization object.
460 * \throw If \a this field is not on Gauss points.
461 * \throw If \a locId is not within the valid range.
462 * \throw If the spatial discretization of \a this field is NULL.
464 const MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId) const
466 if(!((const MEDCouplingFieldDiscretization *)_type))
467 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
468 return _type->getGaussLocalization(locId);
471 MEDCouplingField::~MEDCouplingField()
477 MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature):_nature(nature),_mesh(0),_type(type)
481 MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(0),_type(MEDCouplingFieldDiscretization::New(type))
485 MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy):RefCountObject(other),_name(other._name),_desc(other._desc),_nature(other._nature),
494 _type=other._type->clone();
500 * Returns a new MEDCouplingMesh constituted by some cells of the underlying mesh of \a
501 * this field, and returns ids of entities (nodes, cells, Gauss points) lying on the
502 * specified cells. The cells to include to the result mesh are specified by an array of
503 * cell ids. The new mesh shares the coordinates array with the underlying mesh.
504 * \param [in] start - an array of cell ids to include to the result mesh.
505 * \param [in] end - specifies the end of the array \a start, so that
506 * the last value of \a start is \a end[ -1 ].
507 * \param [out] di - a new instance of DataArrayInt holding the ids of entities (nodes,
508 * cells, Gauss points). The caller is to delete this array using decrRef() as it
510 * \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to
511 * delete this mesh using decrRef() as it is no more needed.
512 * \throw If the spatial discretization of \a this field is NULL.
513 * \throw If the mesh is not set.
514 * \sa buildSubMeshDataRange()
516 MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const
518 if(!((const MEDCouplingFieldDiscretization *)_type))
519 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshData method !");
520 return _type->buildSubMeshData(_mesh,start,end,di);
524 * 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.
526 * \param [out] beginOut Valid only if \a di is NULL
527 * \param [out] endOut Valid only if \a di is NULL
528 * \param [out] stepOut Valid only if \a di is NULL
529 * \param [out] di is an array returned that specifies entity ids (nodes, cells, Gauss points... ) in array if no output range is foundable.
531 * \sa MEDCouplingField::buildSubMeshData
533 MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(int begin, int end, int step, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
535 if(!((const MEDCouplingFieldDiscretization *)_type))
536 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshDataRange method !");
537 return _type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,di);
541 * This method returns tuples ids implied by the mesh selection of the cell ids contained in array defined as an interval [start;end).
542 * \return a newly allocated DataArrayInt instance containing tuples ids.
544 DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const
546 if(!((const MEDCouplingFieldDiscretization *)_type))
547 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call computeTupleIdsToSelectFromCellIds method !");
548 return _type->computeTupleIdsToSelectFromCellIds(_mesh,startCellIds,endCellIds);
552 * Returns number of tuples expected regarding the spatial discretization of \a this
553 * field and number of entities in the underlying mesh. This method behaves exactly as MEDCouplingFieldDouble::getNumberOfTuples.
554 * \return int - the number of expected tuples.
555 * \throw If the spatial discretization of \a this field is NULL.
556 * \throw If the mesh is not set.
558 int MEDCouplingField::getNumberOfTuplesExpected() const
560 if(!((const MEDCouplingFieldDiscretization *)_type))
561 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfTuplesExpected method !");
563 return _type->getNumberOfTuples(_mesh);
565 throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfTuplesExpected : Empty mesh !");
568 void MEDCouplingField::setDiscretization(MEDCouplingFieldDiscretization *newDisc)
570 bool needUpdate=(const MEDCouplingFieldDiscretization *)_type!=newDisc;
579 * Returns number of mesh entities in the underlying mesh of \a this field regarding the
580 * spatial discretization.
581 * \return int - the number of mesh entities porting the field values.
582 * \throw If the spatial discretization of \a this field is NULL.
583 * \throw If the mesh is not set.
585 int MEDCouplingField::getNumberOfMeshPlacesExpected() const
587 if(!((const MEDCouplingFieldDiscretization *)_type))
588 throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfMeshPlacesExpected method !");
590 return _type->getNumberOfMeshPlaces(_mesh);
592 throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfMeshPlacesExpected : Empty mesh !");
596 * Copy tiny info (component names, name, description) but warning the underlying mesh is not renamed (for safety reason).
598 void MEDCouplingField::copyTinyStringsFrom(const MEDCouplingField *other)
602 setName(other->_name);
603 setDescription(other->_desc);
608 * This method computes the number of tuples a DataArrayDouble instance should have to build a correct MEDCouplingFieldDouble instance starting from a
609 * submesh of a virtual mesh on which a substraction per type had been applied regarding the spatial discretization in \a this.
611 * 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.
612 * So in those cases attribute \a _mesh of \a this is ignored.
614 * For spatial discretization equal to ON_GAUSS_NE \a _mesh attribute will be taken into account.
616 * The input code is those implemented in MEDCouplingUMesh::splitProfilePerType.
618 * \param [in] code - a code with format described above.
619 * \param [in] idsPerType - a list of subparts
620 * \throw If \a this has no spatial discretization set.
621 * \throw If input code point to invalid zones in spatial discretization.
622 * \throw If spatial discretization in \a this requires a mesh and those mesh is invalid (null,...)
624 int MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
626 const MEDCouplingFieldDiscretization *t(_type);
628 throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfTuplesExpectedRegardingCode : no spatial discretization set !");
629 return t->getNumberOfTuplesExpectedRegardingCode(code,idsPerType);