Sometimes the format old to new for surjections can be replaced by another format with 2 arrays.
Less compact in memory. The \ref ParaMEDMEM::DataArrayInt::changeSurjectiveFormat "DataArrayInt::changeSurjectiveFormat" method performs that.
-\section MEDCouplingArrayRenumberingN2O New to old mode
+\section MEDCouplingArrayRenumberingN2O New-to-old mode
-The new to old mode is particularly recommended for strictly injective and bijective permutations.
+The new-to-old mode is particularly recommended for strictly injective and bijective permutations.
This is particularly useful for methods that increase the number of entities like for example
\ref ParaMEDMEM::MEDCouplingUMesh::simplexize "MEDCouplingUMesh::simplexize".\n
All non static methods in \ref ParaMEDMEM::DataArrayDouble "DataArrayDouble"
capital works with the mode new to old.
Let's consider a call to \ref ParaMEDMEM::MEDCouplingUMesh::simplexize "simplexize" that increases
the number of cell from 4 cells to 6 cells.\n
-In new to old mode the array \b MyInjection that specifies this injection will have 6 tuples
+In new-to-old mode the array \b MyInjection that specifies this injection will have 6 tuples
and 1 component. The content of the 5*1 values will be in {0,1,2,3}.\n
If \b MyInjection equals [2,0,1,1,3,0] it means that :
- new id #4 comes from old id 3
- new id #5 comes from old id 0
-Method in new to old mode that works on bijective applications :
+Method in new-to-old mode that works on bijective applications :
- \ref ParaMEDMEM::DataArrayDouble::renumberR "DataArrayDouble::renumberR"
- \ref ParaMEDMEM::DataArrayDouble::renumberInPlace "DataArrayDouble::renumberInPlaceR"
-Method in new to old mode that works on surjective applications :
+Method in new-to-old mode that works on surjective applications :
- \ref ParaMEDMEM::DataArrayDouble::selectByTupleId "DataArrayDouble::selectByTupleId"
- \ref ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe "DataArrayDouble::selectByTupleIdSafe"
- \ref ParaMEDMEM::DataArrayDouble::selectByTupleId2 "DataArrayDouble::selectByTupleId2"
- \ref ParaMEDMEM::DataArrayDouble::selectByTupleRanges "DataArrayDouble::selectByTupleRanges"
-
+\section numbering-indirect Indirect indexing
+
+The indirect indexing format is made of two \ref arrays "arrays of int (DataArrayInt)" and
+is used to describe a set of groups (a group being here understood as a simple pack of int identifiers).
+Each group of identifier can for example represent a set of coincident nodes, or a set of nodes belonging
+to the same cell, etc ...
+
+\image html IndirectIndex.jpg "Indirect indexing principle"
+
+Denoting \c tab and \c tabI the two arrays of the indirect indexing format,
+we see at the top in the picture above the \c tab array, which contains n packs of identifiers
+(first pack is 3,1,4,6, second pack is 4,3,2,6,5, etc ...), and below the array \c tabI
+which provides the necessary offsets to extract a given pack from \c tab.
+
+This format is widely used internally (this is how the connectivity of
+\ref MEDCouplingUMeshPage "unstructured cells" is stored for example), and is also returned by
+many functions, e.g.:
+- \ref ParaMEDMEM::MEDCouplingPointSet::findCommonCells "MEDCouplingPointSet::findCommonCells"
+- \ref ParaMEDMEM::MEDCouplingPointSet::findCommonNodes "MEDCouplingPointSet::findCommonNodes"
+- \ref ParaMEDMEM::MEDCouplingPointSet::getNodeIdsNearPoints "MEDCouplingPointSet::getNodeIdsNearPoints"
+- \ref ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity "MEDCouplingUMesh::buildDescendingConnectivity"
+- \ref ParaMEDMEM::MEDCouplingUMesh::computeNeighborsOfNodes "MEDCouplingUMesh::computeNeighborsOfNodes"
+- \ref ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh "MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh"
+- \ref ParaMEDMEM::MEDCouplingUMesh::setConnectivity "MEDCouplingUMesh::setConnectivity"
+- \ref ParaMEDMEM::MEDCouplingUMesh::split2DCells "MEDCouplingUMesh::split2DCells"
+
+Some functions in the API to manipulate this format:
+- \ref ParaMEDMEM::DataArrayInt::changeSurjectiveFormat "DataArrayInt::changeSurjectiveFormat"
+- \ref ParaMEDMEM::MEDCouplingUMesh::ExtractFromIndexedArrays "(static) MEDCouplingUMesh::ExtractFromIndexedArrays"
+- \ref ParaMEDMEM::MEDCouplingUMesh::ExtractFromIndexedArrays2 "(static) MEDCouplingUMesh::ExtractFromIndexedArrays2"
*/
\ No newline at end of file
/*!
* Finds nodes coincident within \a prec tolerance.
- * Ids of coincident nodes are stored in output arrays.
- * A pair of arrays (\a comm, \a commIndex) is called "Surjective Format 2".
+ * Ids of coincident nodes are stored in output arrays in the \ref numbering-indirect format.
* \param [in] prec - minimal absolute distance (using infinite norm) between two nodes at which they are
* considered not coincident.
* \param [in] limitNodeId - limit node id. If all nodes within a group of coincident
* \a comm->getNumberOfTuples() == \a commIndex->back(). The caller
* is to delete this array using decrRef() as it is no more needed.
* \param [out] commIndex - the array dividing all ids stored in \a comm into
- * groups of (ids of) coincident nodes. Its every value is a tuple
+ * groups of (ids of) coincident nodes (\ref numbering-indirect). Its every value is a tuple
* index where a next group of nodes begins. For example the second
* group of nodes in \a comm is described by following range of indices:
* [ \a commIndex[1], \a commIndex[2] ). \a commIndex->getNumberOfTuples()-1
* parameter.
* \param [in] eps - the lowest distance between (using infinite norm) a point and a node at which the node is
* not returned by this method.
- * \param [out] c - array returning ids of nodes located closer than \a eps to the
+ * \param [out] c - array (\ref numbering-indirect) returning ids of nodes located closer than \a eps to the
* given points. The caller
* is to delete this array using decrRef() as it is no more needed.
* \param [out] cI - for each i-th given point, the array specifies tuples of \a c
- * holding ids of nodes close to the i-th point. <br>The i-th value of \a cI is an
+ * holding ids of nodes close to the i-th point (\ref numbering-indirect). <br>The i-th value of \a cI is an
* index of tuple of \a c holding id of a first (if any) node close to the
* i-th given point. Difference between the i-th and (i+1)-th value of \a cI
* (i.e. \a cI[ i+1 ] - \a cI[ i ]) defines number of nodes close to the i-th
}
/*!
- * @param comm in param in the same format than one returned by findCommonNodes method.
- * @param commI in param in the same format than one returned by findCommonNodes method.
+ * @param comm in param in the same format than one returned by findCommonNodes method (\ref numbering-indirect).
+ * @param commI in param in the same format than one returned by findCommonNodes method (\ref numbering-indirect).
* @return the old to new correspondance array.
*/
DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex,
* Creates a new MEDCouplingUMesh containing cells, of dimension one less than \a
* this->getMeshDimension(), that bound cells of \a this mesh. In addition arrays
* describing correspondence between cells of \a this and the result meshes are
- * returned. The arrays \a desc and \a descIndx describe the descending connectivity,
+ * returned. The arrays \a desc and \a descIndx (\ref numbering-indirect) describe the descending connectivity,
* i.e. enumerate cells of the result mesh bounding each cell of \a this mesh. The
- * arrays \a revDesc and \a revDescIndx describe the reverse descending connectivity,
+ * arrays \a revDesc and \a revDescIndx (\ref numbering-indirect) describe the reverse descending connectivity,
* i.e. enumerate cells of \a this mesh bounded by each cell of the result mesh.
* \warning For speed reasons, this method does not check if node ids in the nodal
* connectivity correspond to the size of node coordinates array.
* Creates a new MEDCouplingUMesh containing cells, of dimension one less than \a
* this->getMeshDimension(), that bound cells of \a this mesh. In
* addition arrays describing correspondence between cells of \a this and the result
- * meshes are returned. The arrays \a desc and \a descIndx describe the descending
+ * meshes are returned. The arrays \a desc and \a descIndx (\ref numbering-indirect) describe the descending
* connectivity, i.e. enumerate cells of the result mesh bounding each cell of \a this
* mesh. This method differs from buildDescendingConnectivity() in that apart
* from cell ids, \a desc returns mutual orientation of cells in \a this and the
* of two meshes is same, and a negative id means a reverse order of nodes. Since a
* cell with id #0 can't be negative, the array \a desc returns ids in FORTRAN mode,
* i.e. cell ids are one-based.
- * Arrays \a revDesc and \a revDescIndx describe the reverse descending connectivity,
+ * Arrays \a revDesc and \a revDescIndx (\ref numbering-indirect) describe the reverse descending connectivity,
* i.e. enumerate cells of \a this mesh bounded by each cell of the result mesh.
* \warning For speed reasons, this method does not check if node ids in the nodal
* connectivity correspond to the size of node coordinates array.
/*!
* \b WARNING this method do the assumption that connectivity lies on the coordinates set.
- * For speed reasons no check of this will be done. This method calls MEDCouplingUMesh::buildDescendingConnectivity to compute the result.
- * This method lists cell by cell in \b this which are its neighbors. To compute the result only connectivities are considered.
+ * For speed reasons no check of this will be done. This method calls
+ * MEDCouplingUMesh::buildDescendingConnectivity to compute the result.
+ * This method lists cell by cell in \b this which are its neighbors. To compute the result
+ * only connectivities are considered.
* The neighbor cells of cell having id 'cellId' are neighbors[neighborsIndx[cellId]:neighborsIndx[cellId+1]].
+ * The format of return is hence \ref numbering-indirect.
*
- * \param [out] neighbors is an array storing all the neighbors of all cells in \b this. This array is newly allocated and should be dealt by the caller. \b neighborsIndx 2nd output
- * parameter allows to select the right part in this array. The number of tuples is equal to the last values in \b neighborsIndx.
- * \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be dealt by the caller. This arrays allow to use the first output parameter \b neighbors.
+ * \param [out] neighbors is an array storing all the neighbors of all cells in \b this. This array is newly
+ * allocated and should be dealt by the caller. \b neighborsIndx 2nd output
+ * parameter allows to select the right part in this array (\ref numbering-indirect). The number of tuples
+ * is equal to the last values in \b neighborsIndx.
+ * \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be
+ * dealt by the caller. This arrays allow to use the first output parameter \b neighbors (\ref numbering-indirect).
*/
void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) const
{
}
/*!
- * This method is called by MEDCouplingUMesh::computeNeighborsOfCells. This methods performs the algorithm of MEDCouplingUMesh::computeNeighborsOfCells.
- * This method is useful for users that want to reduce along a criterion the set of neighbours cell. This is typically the case to extract a set a neighbours,
+ * This method is called by MEDCouplingUMesh::computeNeighborsOfCells. This methods performs the algorithm
+ * of MEDCouplingUMesh::computeNeighborsOfCells.
+ * This method is useful for users that want to reduce along a criterion the set of neighbours cell. This is
+ * typically the case to extract a set a neighbours,
* excluding a set of meshdim-1 cells in input descending connectivity.
- * Typically \b desc, \b descIndx, \b revDesc and \b revDescIndx input params are the result of MEDCouplingUMesh::buildDescendingConnectivity.
- * This method lists cell by cell in \b this which are its neighbors. To compute the result only connectivities are considered.
+ * Typically \b desc, \b descIndx, \b revDesc and \b revDescIndx (\ref numbering-indirect) input params are
+ * the result of MEDCouplingUMesh::buildDescendingConnectivity.
+ * This method lists cell by cell in \b this which are its neighbors. To compute the result only connectivities
+ * are considered.
* The neighbor cells of cell having id 'cellId' are neighbors[neighborsIndx[cellId]:neighborsIndx[cellId+1]].
*
* \param [in] desc descending connectivity array.
- * \param [in] descIndx descending connectivity index array used to walk through \b desc.
+ * \param [in] descIndx descending connectivity index array used to walk through \b desc (\ref numbering-indirect).
* \param [in] revDesc reverse descending connectivity array.
- * \param [in] revDescIndx reverse descending connectivity index array used to walk through \b revDesc.
+ * \param [in] revDescIndx reverse descending connectivity index array used to walk through \b revDesc (\ref numbering-indirect).
* \param [out] neighbors is an array storing all the neighbors of all cells in \b this. This array is newly allocated and should be dealt by the caller. \b neighborsIndx 2nd output
* parameter allows to select the right part in this array. The number of tuples is equal to the last values in \b neighborsIndx.
* \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be dealt by the caller. This arrays allow to use the first output parameter \b neighbors.
/*!
* \b WARNING this method do the assumption that connectivity lies on the coordinates set.
- * For speed reasons no check of this will be done. This method calls MEDCouplingUMesh::buildDescendingConnectivity to compute the result.
- * This method lists node by node in \b this which are its neighbors. To compute the result only connectivities are considered.
+ * For speed reasons no check of this will be done. This method calls
+ * MEDCouplingUMesh::buildDescendingConnectivity to compute the result.
+ * This method lists node by node in \b this which are its neighbors. To compute the result
+ * only connectivities are considered.
* The neighbor nodes of node having id 'nodeId' are neighbors[neighborsIndx[cellId]:neighborsIndx[cellId+1]].
*
- * \param [out] neighbors is an array storing all the neighbors of all nodes in \b this. This array is newly allocated and should be dealt by the caller. \b neighborsIndx 2nd output
- * parameter allows to select the right part in this array. The number of tuples is equal to the last values in \b neighborsIndx.
- * \param [out] neighborsIdx is an array of size this->getNumberOfCells()+1 newly allocated and should be dealt by the caller. This arrays allow to use the first output parameter \b neighbors.
+ * \param [out] neighbors is an array storing all the neighbors of all nodes in \b this. This array
+ * is newly allocated and should be dealt by the caller. \b neighborsIndx 2nd output
+ * parameter allows to select the right part in this array (\ref numbering-indirect).
+ * The number of tuples is equal to the last values in \b neighborsIndx.
+ * \param [out] neighborsIdx is an array of size this->getNumberOfCells()+1 newly allocated and should
+ * be dealt by the caller. This arrays allow to use the first output parameter \b neighbors.
*/
void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const
{
}
/*!
- * This method find cells that are cells equal (regarding \a compType) in \a this. The comparison is specified by \a compType.
- * This method keeps the coordiantes of \a this. This method is time consuming and is called
+ * This method find cells that are equal (regarding \a compType) in \a this. The comparison is specified
+ * by \a compType.
+ * This method keeps the coordiantes of \a this. This method is time consuming.
*
* \param [in] compType input specifying the technique used to compare cells each other.
* - 0 : exactly. A cell is detected to be the same if and only if the connectivity is exactly the same without permutation and types same too. This is the strongest policy.
* - 2 : nodal. cell1 and cell2 are equal if and only if cell1 and cell2 have same type and have the same nodes constituting connectivity. This is the laziest policy. This policy
* can be used for users not sensitive to orientation of cell
* \param [in] startCellId specifies the cellId starting from which the equality computation will be carried out. By default it is 0, which it means that all cells in \a this will be scanned.
- * \param [out] commonCellsArr
- * \param [out] commonCellsIArr
+ * \param [out] commonCellsArr common cells ids (\ref numbering-indirect)
+ * \param [out] commonCellsIArr common cells ids (\ref numbering-indirect)
* \return the correspondance array old to new in a newly allocated array.
*
*/
}
/*!
- * Defines the nodal connectivity using given connectivity arrays. Optionally updates
+ * Defines the nodal connectivity using given connectivity arrays in \ref numbering-indirect format.
+ * Optionally updates
* a set of types of cells constituting \a this mesh.
* This method is for advanced users having prepared their connectivity before. For
* more info on using this method see \ref MEDCouplingUMeshAdvBuild.
return connOut.retn();
}
+/*!
+ * Convert the nodal connectivity of the mesh so that all the cells are of dynamic types (polygon or quadratic
+ * polygon). This returns the corresponding new nodal connectivity in \ref numbering-indirect format.
+ * \param nodalConn
+ * \param nodalConnI
+ */
void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndex) const
{
static const char msg0[]="MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : nodal connectivity in this are invalid ! Call checkCoherency2 !";
/// @endcond
/**
- * This method split some of edges of 2D cells in \a this. The edges to be split are specified in \a subNodesInSeg and in \a subNodesInSegI using index storage mode.
- * To do the work this method can optionally needs information about middle of subedges for quadratic cases if a minimal creation of new nodes is wanted.
- * So this method try to reduce at most the number of new nodes. The only case that can lead this method to add nodes if a SEG3 is split without information of middle.
- * \b WARNING : is returned value is different from 0 a call to MEDCouplingUMesh::mergeNodes is necessary to avoid to have a non conform mesh.
+ * This method split some of edges of 2D cells in \a this. The edges to be split are specified in \a subNodesInSeg
+ * and in \a subNodesInSegI using \ref numbering-indirect storage mode.
+ * To do the work this method can optionally needs information about middle of subedges for quadratic cases if
+ * a minimal creation of new nodes is wanted.
+ * So this method try to reduce at most the number of new nodes. The only case that can lead this method to add
+ * nodes if a SEG3 is split without information of middle.
+ * \b WARNING : is returned value is different from 0 a call to MEDCouplingUMesh::mergeNodes is necessary to
+ * avoid to have a non conform mesh.
*
* \return int - the number of new nodes created (in most of cases 0).
*
}
/*!
- * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
+ * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn
+ * (\ref numbering-indirect).
* This method returns the result of the extraction ( specified by a set of ids in [\b idsOfSelectBg , \b idsOfSelectEnd ) ).
* The selection of extraction is done standardly in new2old format.
- * This method returns indexed arrays using 2 arrays (arrOut,arrIndexOut).
+ * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut).
*
* \param [in] idsOfSelectBg begin of set of ids of the input extraction (included)
* \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded)
}
/*!
- * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
+ * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn
+ * (\ref numbering-indirect).
* This method returns the result of the extraction ( specified by a set of ids with a slice given by \a idsOfSelectStart, \a idsOfSelectStop and \a idsOfSelectStep ).
* The selection of extraction is done standardly in new2old format.
- * This method returns indexed arrays using 2 arrays (arrOut,arrIndexOut).
+ * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut).
*
* \param [in] idsOfSelectStart begin of set of ids of the input extraction (included)
* \param [in] idsOfSelectStop end of set of ids of the input extraction (excluded)