1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
5 * \file MULTIPR_Nodes.hxx
7 * \brief Class Nodes = table of nodes.
9 * \author Olivier LE ROUX - CS, Virtual Reality Dpt
14 #ifndef MULTIPR_NODES_HXX
15 #define MULTIPR_NODES_HXX
17 //*****************************************************************************
19 //*****************************************************************************
34 //*****************************************************************************
36 //*****************************************************************************
43 * Builds an empty set of nodes (default constructor).
48 * Destructor. Removes everything.
53 * Resets this object in its state by default (empty). Cleans memory.
57 //---------------------------------------------------------------------
58 // Basic accessors/mutators
59 //---------------------------------------------------------------------
62 * Returns true if nodes have a name.
63 * \return true if nodes have a name.
65 bool isNames() const { return (mNames != NULL); }
68 * Returns true if elements have an identifier (= a number).
69 * \return true if elements have an identifier (= a number).
71 bool isIdentifiers() const { return (mId != NULL); }
74 * Returns the coordinates of one node according to its index.
75 * \param pIndexNode index of node in [0..NUMBER_OF_NODES-1].
76 * \return the coordinates of one node.
77 * \throw IndexOutOfBoundsException if pIndexNode is invalid.
79 const med_float* getCoordinates(med_int pIndexNode) const;
82 * Returns the family of one node.
83 * \param pIndexNode index of node in [0..NUMBER_OF_NODES-1].
84 * \return the family of the given node.
85 * \throw IndexOutOfBoundsException if pIndexNode is invalid.
87 med_int getFamIdent(med_int pIndexNode) const;
90 * Returns the number of nodes.
91 * \return the number of nodes.
93 int getNumberOfNodes() const { return mNum; }
95 //---------------------------------------------------------------------
97 //---------------------------------------------------------------------
100 * Returns the axis-aligned bounding box (CARTESIAN coordinates system) of this set of nodes.
101 * \param pMin (out) coordinates of the min-corner of the bbox.
102 * \param pMin (out) coordinates of the max-corner of the bbox.
104 void getBBox(med_float pMin[3], med_float pMax[3]) const;
107 * Returns the set of families referenced by this set of nodes.
108 * Each family is described by its identifier.
109 * \return the set of families referenced by this set of nodes.
111 std::set<med_int> getSetOfFamilies() const;
114 * Constructor. Creates a subset of this set of nodes from a set of indices.
115 * \param pSetOfIndices set of indices; each index must be >= 1.
116 * \return a subset of this set of nodes from a set of indices.
118 Nodes* extractSubSet(const std::set<med_int>& pSetIndices) const;
120 //---------------------------------------------------------------------
122 //---------------------------------------------------------------------
125 * Reads all nodes of a mesh from a MED file.
126 * \param pMEDfile any valid MED file opened for reading.
127 * \param pMeshName name of the mesh to be read.
128 * \param pDim dimension of the mesh.
129 * \throw IOException if any i/o error occurs.
131 void readMED(med_idt pMEDfile, char* pMeshName, med_int pDim);
134 * Writes this set of nodes to a MED file. Nodes are associated with the given mesh.
135 * WARNING: mesh must have been created and added to the MED file before.
136 * \param pMEDfile any valid MED file opened for writing.
137 * \param pMeshName any mesh of the MED file.
138 * \throw IOException if any i/o error occurs.
140 void writeMED(med_idt pMEDfile, char* pMeshName) const;
143 * Sets the flag which control the stream operator <<.
144 * \param pFlag new flag value.
146 void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; }
149 * Dumps any Nodes to the given output stream.
150 * \param pOs any output stream.
151 * \param pN any Nodes.
152 * \return the output stream pOs.
154 friend std::ostream& operator<<(std::ostream& pOs, Nodes& pN);
158 med_int mNum; /**< Number of nodes in this set. */
159 med_int mDim; /**< Dimension of nodes. */
160 med_repere mCoordSystem; /**< Type of coordinates system; should be MED_CART for cartesian. */
162 med_int* mId; /**< Optional; for each node, its identifier; NULL if undefined. */
163 med_int* mFamIdent; /**< For each node, its identifier of its family. */
164 char* mNames; /**< Optional; for each node, its name; NULL if undefined. */
165 med_float* mCoo; /**< For each node, coordinates of node; array is interlaced: x1 y1 z1 x2 y2 z2 ...*/
166 char* mNamesCoo; /**< Names of axis of the coordinates system. */
167 char* mNamesUnitCoo; /**< Unit of axis of the coordinates system. */
169 bool mFlagPrintAll; /** Flag to control the behaviour of the stream operator <<. */
173 // do not allow copy constructor
177 Nodes& operator=(const Nodes&);
179 // do not allow operator ==
180 bool operator==(const Nodes&);
185 } // namespace MULTIPR
188 #endif // MULTIPR_NODES_HXX