1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
5 * \file MULTIPR_Profil.hxx
7 * \brief Class Profil used to managed MED profil.
8 * Profil is just a list of indices related to elements (NODES, CELLS).
9 * !!! currently not used !!!
11 * \author Olivier LE ROUX - CS, Virtual Reality Dpt
16 #ifndef MULTIPR_PROFIL_HXX
17 #define MULTIPR_PROFIL_HXX
19 //*****************************************************************************
21 //*****************************************************************************
41 //*****************************************************************************
43 //*****************************************************************************
50 * Builds an empty profil (default constructor).
56 * \param pProfil The profil to copy.
58 Profil(const Profil& pProfil);
61 * Destructor. Removes everything.
66 * Resets this object in its state by default (empty). Cleans memory.
71 * Creates a profil from its name (reset before).
72 * \param pName name of the profil to be created.
73 * \throw NullArgumentException if pName is NULL.
75 void create(const char* pName);
77 //---------------------------------------------------------------------
78 // Basic accessors/mutators
79 //---------------------------------------------------------------------
82 * Returns the name of this profil.
83 * \return the name of this profil.
85 const char* getName() const;
88 * Get the complete set of elements of this profile.
89 * \return The set of elements.
91 std::set< med_int>& getSet() { return mTable; }
94 * Adds a new element to this profil.
95 * \param pElt element to be added; must be >= 1.
97 void add(med_int pElt);
100 * Find the given element in the profile.
101 * \param pElt The index of the element.
102 * \return true if the element was found.
104 bool find(med_int pElt);
107 * Assign a set of element to this profile.
108 * \param pElt The set of element to assign.
110 void set(std::set< med_int>& pElt) { this->mTable = pElt; }
113 * Select the elements of pIn contained in this profile. The two parameters pIn
114 * and pOut MUST be different.
115 * \param pIn Set of elements to filter.
116 * \param pOut The result.
117 * \throw IllegalStateException if pIn and pOut are not different.
119 void filterSetOfElement(std::set<med_int>& pIn, std::set<med_int>& pOut);
122 * Extract a profil. The two parameters pIn
123 * and pOut MUST be different.
124 * \param pIn Set of elements to extract.
125 * \param pOut The result.
126 * \throw IllegalStateException if pIn and pOut are not different.
128 void extractSetOfElement(const std::set<med_int>& pIn, std::set<med_int>& pOut);
131 * Returns the association of the profile.
132 * \return OnNodes or OnElements or Undef.
134 eProfilBinding getBinding() { return mBinding; }
137 * Return the index of the geometry (if any) associated with this profile.
138 * If this profile is on nodes it will return 0. Since the geometry index starts at
139 * 0 use getBinding to know if its on elements.
140 * \return the index of the geometry.
142 unsigned getGeomIdx() { return mGeomIdx; }
144 //---------------------------------------------------------------------
146 //---------------------------------------------------------------------
149 * Reads a Profil from a MED file.
150 * \param pMEDfile any valid MED file opened for reading.
151 * \param pIndexProfil index of the profil to be read; must be >= 1.
152 * \throw IOException if any i/o error occurs.
154 void readMED(med_idt pMEDfile, med_int pIndexProfil);
157 * Try to find in the MED file if this profile is associated to the nodes
158 * or the elements. If the profile is associated with elements it will get the
159 * index of the geometry.
160 * \param pMEDfile any valid MED file opened for reading.
161 * \param pMeshName The name of the mesh.
162 * \throw IllegalStateException if the profile is empty.
164 void readProfilBinding(med_idt pMEDfile, char* pMeshName);
167 * Writes this profil to a MED file.
168 * \param pMEDfile any valid MED file opened for writing.
169 * \throw IOException if any i/o error occurs.
171 void writeMED(med_idt pMEDfile);
174 * Dumps any Profil to the given output stream.
175 * \param pOs any output stream.
176 * \param pP any Profil.
177 * \return the output stream pOs.
179 friend std::ostream& operator<<(std::ostream& pOs, Profil& pP);
183 char mName[MED_TAILLE_NOM + 1]; /**< Name of the profil. */
184 std::set<med_int> mTable; /**< Table of elements. */
185 eProfilBinding mBinding; /**< Profil of nodes or elements. */
186 unsigned mGeomIdx; /**< If this profile is on elements, the index of the geometry. */
191 Profil& operator=(const Profil&);
193 // do not allow operator ==
194 bool operator==(const Profil&);
199 } // namespace MULTIPR
202 #endif // MULTIPR_PROFIL_HXX