* Clears data on Gauss points localization.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
*/
void MEDCouplingField::clearGaussLocalizations()
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling clearGaussLocalizations method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call clearGaussLocalizations method !");
_type->clearGaussLocalizations();
* \throw If \a this field is not on Gauss points.
* \throw If \a locId is not within the valid range.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
*/
MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception)
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalization method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
return _type->getGaussLocalization(locId);
* \return int - the id of the Gauss localization object.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
* \throw If no Gauss localization object found for the given cell \a type.
* \throw If more than one Gauss localization object found for the given cell \a type.
*/
int MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdOfOneType method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneType method !");
return _type->getGaussLocalizationIdOfOneType(type);
* \param [in] type - the cell type of interest.
* \return std::set<int> - ids of the Gauss localization object.
* \throw If \a this field is not on Gauss points.
- * \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
+ * \throw If the spatial discretization of \a this field is NULL
*/
std::set<int> MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdsOfOneType method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdsOfOneType method !");
return _type->getGaussLocalizationIdsOfOneType(type);
* \return int - the number of available Gauss localization objects.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
*/
int MEDCouplingField::getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception)
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling getNbOfGaussLocalization method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNbOfGaussLocalization method !");
return _type->getNbOfGaussLocalization();
* \return int - the id of the Gauss localization object.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
* \throw If no Gauss localization object found for the given cell.
*/
int MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception)
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdOfOneCell method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneCell method !");
return _type->getGaussLocalizationIdOfOneCell(cellId);
* \throw If \a this field is not on Gauss points.
* \throw If \a locId is not within the valid range.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
*/
void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception)
{
cellIds.clear();
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdOfOneCell method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getCellIdsHavingGaussLocalization method !");
_type->getCellIdsHavingGaussLocalization(locId,cellIds);
* \throw If \a this field is not on Gauss points.
* \throw If \a locId is not within the valid range.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If the mesh is not set.
*/
const MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalization method !");
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
return _type->getGaussLocalization(locId);
setDescription(other->_desc.c_str());
}
}
+
+/*!
+ * This method computes the number of tuples a DataArrayDouble instance should have to build a correct MEDCouplingFieldDouble instance starting from a
+ * submesh of a virtual mesh on which a substraction per type had been applied regarding the spatial discretization in \a this.
+ *
+ * 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.
+ * So in those cases attribute \a _mesh of \a this is ignored.
+ *
+ * For spatial discretization equal to ON_GAUSS_NE \a _mesh attribute will be taken into account.
+ *
+ * The input code is those implemented in MEDCouplingUMesh::splitProfilePerType.
+ *
+ * \param [in] code - a code with format described above.
+ * \param [in] idsPerType - a list of subparts
+ * \throw If \a this has no spatial discretization set.
+ * \throw If input code point to invalid zones in spatial discretization.
+ * \throw If spatial discretization in \a this requires a mesh and those mesh is invalid (null,...)
+ */
+int MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ const MEDCouplingFieldDiscretization *t(_type);
+ if(!t)
+ throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfTuplesExpectedRegardingCode : no spatial discretization set !");
+ return t->getNumberOfTuplesExpectedRegardingCode(_mesh,code,idsPerType);
+}