}
}
-MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction),_nb_nodes(other._nb_nodes)
+MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):RefCountObject(other),_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction),_nb_nodes(other._nb_nodes)
{
}
_pfls.resize(1); _pfls[0]=0;
}
-void MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const
+/*!
+ * If returned value is false output pointer \a coords is not the internal pointer. If returned value is true output pointer \a coords is directly the internal pointer.
+ * If true is returned, the \a coords output parameter should be used with care (non const method call) to avoid to change the internal state of MEDFileUMesh instance.
+ */
+bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const
{
if(_parts.empty())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : empty array !");
}
}
}
+ bool ret(true);
if(!isPolyh)
- reorderNodesIfNecessary(a,d,0);
+ ret=reorderNodesIfNecessary(a,d,0);
else
- reorderNodesIfNecessary(a,d,f);
+ ret=reorderNodesIfNecessary(a,d,f);
+ if(a->getNumberOfComponents()!=3)
+ {
+ a=a->changeNbOfComponents(3,0.);
+ ret=false;
+ }
coords=a.retn(); types=b.retn(); cellLocations=c.retn(); cells=d.retn();
if(!isPolyh)
{ faceLocations=0; faces=0; }
else
{ faceLocations=e.retn(); faces=f.retn(); }
+ return ret;
}
-void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const
+/*!
+ * If returned value is false in/output pointer \a coords is modified. If returned value is true in/output pointer \a coords is not modifed.
+ */
+bool MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const
{
const DataArrayInt *nr(_node_reduction);
if(!nr)
- return ;
+ return true;
int sz(coords->getNumberOfTuples());
std::vector<bool> b(sz,false);
const int *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
}
}
coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end()));
+ return false;
}
//=
const MEDFileField1TSStructItem2& MEDFileField1TSStructItem::operator[](std::size_t i) const throw(INTERP_KERNEL::Exception)
{
- if(i<0 || i>=_items.size())
+ if(i>=_items.size())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::operator[] : input is not in valid range !");
return _items[i];
}