93#include "arcane/utils/ArcanePrecomp.h"
94#include "arcane/utils/Iostream.h"
95#include "arcane/utils/StdHeader.h"
96#include "arcane/utils/HashTableMap.h"
97#include "arcane/utils/ValueConvert.h"
98#include "arcane/utils/ScopedPtr.h"
99#include "arcane/utils/ITraceMng.h"
100#include "arcane/utils/String.h"
101#include "arcane/utils/IOException.h"
102#include "arcane/utils/PlatformUtils.h"
103#include "arcane/utils/Collection.h"
104#include "arcane/utils/Enumerator.h"
105#include "arcane/utils/NotImplementedException.h"
106#include "arcane/utils/Real3.h"
108#include "arcane/FactoryService.h"
109#include "arcane/IMainFactory.h"
110#include "arcane/IMeshReader.h"
111#include "arcane/ISubDomain.h"
112#include "arcane/IMesh.h"
113#include "arcane/IItemFamily.h"
114#include "arcane/Item.h"
115#include "arcane/ItemEnumerator.h"
116#include "arcane/VariableTypes.h"
117#include "arcane/IVariableAccessor.h"
118#include "arcane/IParallelMng.h"
119#include "arcane/IIOMng.h"
120#include "arcane/IXmlDocumentHolder.h"
121#include "arcane/XmlNodeList.h"
122#include "arcane/XmlNode.h"
123#include "arcane/IMeshUtilities.h"
124#include "arcane/IMeshWriter.h"
125#include "arcane/BasicService.h"
127#include "arcane/AbstractService.h"
129#define XDMF_USE_ANSI_STDLIB
130#include <vtkxdmf2/Xdmf.h>
135ARCANE_BEGIN_NAMESPACE
137using namespace xdmf2;
154 bool xmfWriteHead(
void);
155 bool xmfWriteTail(
void);
157 bool xmfWriteDomainHeader(
void);
158 bool xmfWriteDomainFooter(
void);
160 bool xmfWriteGridHeader(
char*,
char*);
161 bool xmfWriteGridFooter(
void);
163 bool xmfWriteTopologyHeader(
char*,
XdmfInt32);
164 bool xmfWriteTopologyFooter(
void);
167 bool xmfWriteGeometryFooter(
void);
170 bool xmfWriteDataItemFooter(
void);
173 void IncrementIndent() { this->CurrIndent ++; }
174 void DecrementIndent() {
if (this->CurrIndent >= 0) this->CurrIndent--; }
178 void _switchXmfType(Integer, Array<Integer>&);
180 char *HeavyDataSetNameString;
193void XmfMeshWriter::_switchXmfType(Integer arc_type, Array<Integer>& arcConnectivityArray){
194 if (arc_type > ItemTypeMng::nbBasicItemType()){
195 arcConnectivityArray.add(XDMF_NOTOPOLOGY);
200 case (IT_NullType): arcConnectivityArray.add(XDMF_NOTOPOLOGY);
return;
203 arcConnectivityArray.add(XDMF_POLYVERTEX);
204 arcConnectivityArray.add(1ul);
return;
207 arcConnectivityArray.add(XDMF_POLYLINE);
208 arcConnectivityArray.add(2ul);
return;
210 case (IT_Triangle3): arcConnectivityArray.add(XDMF_TRI);
return;
211 case (IT_Quad4): arcConnectivityArray.add(XDMF_QUAD);
return;
212 case (IT_Pentagon5): arcConnectivityArray.add(XDMF_POLYGON);
return;
213 case (IT_Hexagon6): arcConnectivityArray.add(XDMF_POLYGON);
return;
214 case (IT_Heptagon7): arcConnectivityArray.add(XDMF_POLYGON);
return;
215 case (IT_Octogon8): arcConnectivityArray.add(XDMF_POLYGON);
return;
216 case (IT_Tetraedron4): arcConnectivityArray.add(XDMF_TET);
return;
217 case (IT_Pyramid5): arcConnectivityArray.add(XDMF_PYRAMID);
return;
218 case (IT_Pentaedron6): arcConnectivityArray.add(XDMF_WEDGE);
return;
219 case (IT_Hexaedron8): arcConnectivityArray.add(XDMF_HEX);
return;
220 case (IT_Heptaedron10): arcConnectivityArray.add(XDMF_TET_10);
return;
222 case (IT_Octaedron12):
223 arcConnectivityArray.add(XDMF_POLYVERTEX);
224 arcConnectivityArray.add(12ul);
return;
225case (IT_Enneedron14):
226 arcConnectivityArray.add(XDMF_POLYVERTEX);
227 arcConnectivityArray.add(14ul);
return;
228 case (IT_Decaedron16):
229 arcConnectivityArray.add(XDMF_POLYVERTEX);
230 arcConnectivityArray.add(16ul);
return;
232 arcConnectivityArray.add(XDMF_POLYVERTEX);
233 arcConnectivityArray.add(7ul);
return;
237 case (IT_AntiWedgeLeft6):
238 case (IT_AntiWedgeRight6):
239 arcConnectivityArray.add(XDMF_POLYVERTEX);
240 arcConnectivityArray.add(6ul);
return;
245 arcConnectivityArray.add(XDMF_POLYVERTEX);
246 arcConnectivityArray.add(5ul);
return;
251 case (IT_DualCell): arcConnectivityArray.add(XDMF_NOTOPOLOGY);
return;
253 default: arcConnectivityArray.add(XDMF_NOTOPOLOGY);
return;
255 arcConnectivityArray.add(XDMF_NOTOPOLOGY);
265 info() <<
"[XmfMeshWriter::writeMeshToFile] nNodes=" <<mesh->
nbNode() <<
" nCells="<< mesh->
nbCell()
266 <<
" all=" << mesh->
allNodes().size() <<
", own=" << mesh->
ownNodes().size();
273 if (platform::isFileReadable(
file_name+
".h5")==
true)
274 if (platform::removeFile(
file_name+
".h5"))
277 if (
xmfDom->SetWorkingDirectory(
".")!= XDMF_SUCCESS)
throw IOException(
"writeMeshToFile",
"SetOutputFileName");
281 info() <<
"XDMF-side initialisation done";
287 info() <<
"[XmfMeshWriter] Domain initialisation done";
292 info() <<
"[XmfMeshWriter] Grid initialisation done";
342 info() <<
"[XmfMeshWriter] Focussing on the topology";
353 Integer nbNodes = cell.
nbNode();
357 for( Integer
j=0;
j<nbNodes;++
j){
372 info() <<
"[XmfMeshWriter] Work on grid->topology done";
392 info() <<
"[XmfMeshWriter] Work on Geometry done";
402 info() <<
"[XmfMeshWriter] Working on Groups";
406 info() <<
"[writeMeshToFile] Found a " <<
arcGroup->itemKind() <<
"-group " <<
arcGroup->name();
414 xmfGroup->SetNumberType(XDMF_INT32_TYPE);
442 info() <<
"[XmfMeshWriter] Done";
#define ARCANE_REGISTER_SUB_DOMAIN_FACTORY(aclass, ainterface, aname)
Enregistre un service de fabrique pour la classe aclass.
Classe de base d'un service.
virtual NodeGroup ownNodes()=0
Groupe de tous les noeuds propres au domaine.
virtual IItemFamily * nodeFamily()=0
Retourne la famille des noeuds.
virtual Integer nbCell()=0
Nombre de mailles du maillage.
virtual IItemFamily * edgeFamily()=0
Retourne la famille des arêtes.
virtual Integer nbNode()=0
Nombre de noeuds du maillage.
virtual IItemFamily * faceFamily()=0
Retourne la famille des faces.
virtual NodeGroup allNodes()=0
Groupe de tous les noeuds.
virtual CellGroup allCells()=0
Groupe de toutes les mailles.
virtual IItemFamily * cellFamily()=0
Retourne la famille des mailles.
Interface d'un service d'écriture d'un maillage.
virtual VariableNodeReal3 & nodesCoordinates()=0
Coordonnées des noeuds.
virtual ItemGroupCollection groups()=0
Liste des groupes.
Exception lorsqu'une erreur d'entrée/sortie est détectée.
Node node(Int32 i) const
i-ème noeud de l'entité
Int32 nbNode() const
Nombre de noeuds de l'entité
ItemUniqueId uniqueId() const
Identifiant unique sur tous les domaines.
Int16 type() const
Type de l'entité
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Structure contenant les informations pour créer un service.
Ecriture des fichiers de maillage aux format xmf.
virtual void build(void)
Construction de niveau build du service.
Exception lorsqu'une erreur fatale est survenue.
Chaîne de caractères unicode.
Vecteur 1D de données avec sémantique par valeur (style STL).