* the format of returned DataArrayInt instance.
*
* \return a newly allocated DataArrayInt sorted ascendingly of fetched node ids.
- * \sa MEDCoupling1SGTUMesh::getNodeIdsInUse
+ * \sa MEDCoupling1SGTUMesh::getNodeIdsInUse, areAllNodesFetched
*/
DataArrayInt *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const
{
* \throw If the coordinates array is not set.
* \throw If the nodal connectivity of cells is not defined.
* \throw If the nodal connectivity includes an invalid id.
- * \sa MEDCoupling1SGTUMesh::computeFetchedNodeIds
+ * \sa MEDCoupling1SGTUMesh::computeFetchedNodeIds, areAllNodesFetched
*/
DataArrayInt *MEDCoupling1SGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const
{
* \throw If the coordinates array is not set.
* \throw If the nodal connectivity of cells is not defined.
* \throw If the nodal connectivity includes an invalid id.
- * \sa MEDCoupling1DGTUMesh::computeFetchedNodeIds
+ * \sa MEDCoupling1DGTUMesh::getNodeIdsInUse, areAllNodesFetched
*/
DataArrayInt *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const
{
* \throw If the coordinates array is not set.
* \throw If the nodal connectivity of cells is not defined.
* \throw If the nodal connectivity includes an invalid id.
- * \sa MEDCoupling1DGTUMesh::computeFetchedNodeIds
+ * \sa MEDCoupling1DGTUMesh::computeFetchedNodeIds, areAllNodesFetched
*/
DataArrayInt *MEDCoupling1DGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const
{
return ret.retn();
}
+/*!
+ * This const method states if the nodal connectivity of this fetches all nodes in \a this.
+ * In other words, this method looks is there are no orphan nodes in \a this.
+ * \sa zipCoordsTraducer, getNodeIdsInUse, computeFetchedNodeIds.
+ */
+bool MEDCouplingPointSet::areAllNodesFetched() const
+{
+ checkFullyDefined();
+ int nbNodes(getNumberOfNodes());
+ std::vector<bool> fetchedNodes(nbNodes,false);
+ computeNodeIdsAlg(fetchedNodes);
+ return std::find(fetchedNodes.begin(),fetchedNodes.end(),false)==fetchedNodes.end();
+}
+
/*!
* Checks if \a this and \a other meshes are geometrically equivalent, else an
* exception is thrown. The meshes are
MEDCOUPLING_EXPORT virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 0;
MEDCOUPLING_EXPORT virtual DataArrayInt *zipCoordsTraducer();
MEDCOUPLING_EXPORT virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0);
+ MEDCOUPLING_EXPORT virtual bool areAllNodesFetched() const;
//tools
public:
MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const;
* the format of returned DataArrayInt instance.
*
* \return a newly allocated DataArrayInt sorted ascendingly of fetched node ids.
- * \sa MEDCouplingUMesh::getNodeIdsInUse
+ * \sa MEDCouplingUMesh::getNodeIdsInUse, areAllNodesFetched
*/
DataArrayInt *MEDCouplingUMesh::computeFetchedNodeIds() const
{
/*!
* \param [in,out] nodeIdsInUse an array of size typically equal to nbOfNodes.
- * \sa MEDCouplingUMesh::getNodeIdsInUse
+ * \sa MEDCouplingUMesh::getNodeIdsInUse, areAllNodesFetched
*/
void MEDCouplingUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
* \throw If the coordinates array is not set.
* \throw If the nodal connectivity of cells is not defined.
* \throw If the nodal connectivity includes an invalid id.
+ * \sa areAllNodesFetched
*
* \if ENABLE_EXAMPLES
* \ref cpp_mcumesh_zipCoordsTraducer "Here is a C++ example".<br>
self.assertTrue(m2D.getNodalConnectivity().isEqual(DataArrayInt([4,1,2,6,5,4,5,6,10,9])))
self.assertTrue(m2D.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10])))
pass
+
+ def testPointSetAreAllNodesFetched1(self):
+ m=MEDCouplingCMesh() ; arr=DataArrayDouble(10) ; arr.iota()
+ m.setCoords(arr,arr)
+ m=m.buildUnstructured()
+ self.assertTrue(m.areAllNodesFetched())
+ m2=m[[0,2,3,4,5]]
+ self.assertTrue(not m2.areAllNodesFetched())
+ m2.zipCoords()
+ self.assertTrue(m2.areAllNodesFetched())
+ pass
pass
if __name__ == '__main__':
virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
virtual void renumberNodesWithOffsetInConn(int offset) throw(INTERP_KERNEL::Exception);
+ virtual bool areAllNodesFetched() const throw(INTERP_KERNEL::Exception);
%extend
{
std::string __str__() const throw(INTERP_KERNEL::Exception)