6 #include "SM_Constants.h"
12 #include "CORE_OutputFile.h"
29 static const tFlag
XML;
32 static const tFlag
HDF;
36 static const tString FILE_TYPES[];
41 tString mExternalFileName;
45 CORE_UniquePointer<CORE_OutputFile> mFile;
72 inline static CORE_UniquePointer<SM_XDMF>
New() {
79 inline static CORE_UniquePointer<SM_XDMF>
New(
const tFlag& format) {
80 CORE_UniquePointer<SM_XDMF> p=
New();
115 mem+=mExternalFileName.size();
116 mem+=(mFile.get()==
null)?0:mFile->getContentsMemorySize();
150 return mExternalFileName;
165 tString xdmfFile=fileName+
".xmf";
168 if (!mFile->open(xdmfFile))
return false;
177 f<<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"<<
"\n";
178 f<<
"<Xdmf xmlns:xi=\"http://www.w3.org/2001/XInclude\" Version=\"3.3\">"<<
"\n";
179 f<<
"\t<Domain>"<<
"\n";
180 f<<
"\t\t<Grid CollectionType=\"Temporal\" GridType=\"Collection\" Name=\"Collection\">"<<
"\n";
191 inline tBoolean
open(
const tIndex& t){
203 tBoolean succeeds=
true;
209 tString tab=
"\t\t\t";
224 f<<tab<<
"</Topology>"<<
"\n";
236 tBoolean succeeds=
true;
242 tString tab=
"\t\t\t";
243 f<<tab<<
"<Geometry name=\"geometry\" Type=\"XYZ\">"<<
"\n";
245 f<<tab<<
"</Geometry>"<<
"\n";
259 const tFlag& support,
260 const std::vector<tString>& scalarNames,
261 const std::vector<tString>& vectorNames) {
277 const tFlag& support,
278 const tString& name,
const tReal& alpha,
281 tString tab=
"\t\t\t";
282 tString tab2=tab+
"\t";
287 file<<tab<<
"<Grid Name=\"Grid\">"<<
"\n";
289 file<<tab2<<
"<Time Value=\""<<std::setprecision(10)<<t<<
"\"/>"<<
"\n";
291 file<<tab2<<
"<Geometry Reference=\"/Xdmf/Domain/Grid/Geometry[1]\"/>"<<
"\n";
296 file<<tab2<<
"<Topology Reference=\"/Xdmf/Domain/Grid/Topology[1]\"/>"<<
"\n";
308 file<<tab<<
"</Grid>"<<
"\n";
337 inline tBoolean
close(
const tIndex& t) {
350 f<<
"\t\t</Grid>"<<
"\n";
351 f<<
"\t</Domain>"<<
"\n";
382 const tFlag& fileType,
const tString& linkHDFFile,
399 const tFlag& fileType,
const tString& linkHDFFile,
400 const tIndex& nAloneParticles,
401 const tIndex& nHaloParticles,
402 const std::valarray<tIndex>& neighboringParticlesListOffset,
403 const std::valarray<tIndex>& neighboringParticlesList,
404 const tString& tagN);
423 const tFlag& fileType,
const tString& linkHDFFile,
425 const tFlag& contentType,
427 const tString& tagName,
430 const tDimension& dim,
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
this class describes a writing file
Definition: CORE_OutputFile.h:16
void close()
close the file
Definition: CORE_OutputFile.h:125
static constexpr tDimension DIM
space dimension
Definition: SM_Constants.h:80
This class is describes a network composed by.
Definition: SM_Network.h:66
const std::valarray< tIndex > & getNeighboringParticlesList() const
get the neighbors indices
Definition: SM_Network.h:399
tIndex computeAloneParticlesNumber() const
return the particles number without any connection
Definition: SM_Network.h:516
const tInteger & getHaloParticlesNumber() const
return the halo particles number
Definition: SM_Network.h:355
const tInteger & getParticlesNumber() const
return the particles number
Definition: SM_Network.h:349
const std::valarray< tIndex > & getNeighboringParticlesNumberOffset() const
get the index of the array mNeighboringParticlesList of the first neighbor of the particle p
Definition: SM_Network.h:428
This class is a beam output interface for VTK / Paraview software.
Definition: SM_VTK.h:21
const tString & getFileName() const
get the file name without extension
Definition: SM_VTK.h:158
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_VTK.h:102
void setIsFileOpened(const tBoolean &v)
set true is the file is opened
Definition: SM_VTK.h:217
This class is a beam interface output for XMF format for paraview visualization software.
Definition: SM_XDMF.h:22
SM_XDMF(void)
create
Definition: SM_XDMF.cpp:9
tBoolean writeContentFooter(const tIndex &t, const tFlag &support)
write a content footer
Definition: SM_XDMF.h:318
static CORE_UniquePointer< SM_XDMF > New()
create an XDMF class
Definition: SM_XDMF.h:72
tBoolean close()
close the file
Definition: SM_XDMF.h:344
virtual ~SM_XDMF(void)
destroy
Definition: SM_XDMF.cpp:25
tBoolean writeContentData(const tReal &t, const SM_Network &network, const tFlag &support, const tString &name, const tReal &alpha, const tReal *f)
write a content data
Definition: SM_XDMF.h:275
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_XDMF.h:112
tBoolean writeGeometryData(const tIndex &t, const SM_Network &network)
write the geometry data of the network
Definition: SM_XDMF.h:234
tBoolean writeGeometryFooter(const tIndex &t)
write the geometry footer
Definition: SM_XDMF.h:327
tBoolean close(const tIndex &t)
close the file for the time step t
Definition: SM_XDMF.h:337
const tString & getExternalFileName() const
get the external file name to find data
Definition: SM_XDMF.h:149
tBoolean writeGeometryHeader(const tIndex &it, const SM_Network &network)
write the geometry header corresponding to the network
Definition: SM_XDMF.h:202
static const tFlag XML
XML file type.
Definition: SM_XDMF.h:29
void setFormat(const tFlag &f)
set the format of the data
Definition: SM_XDMF.h:135
static tBoolean WriteVertices(CORE_OutputFile &file, const tFlag &fileType, const tString &linkHDFFile, const SM_Network &mesh, const tString &tag)
write the vertices coordinates
Definition: SM_XDMF.cpp:37
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_XDMF.h:100
static const tFlag HDF
HDF file type.
Definition: SM_XDMF.h:32
tBoolean writeContentHeader(const tIndex &t, const tFlag &support, const std::vector< tString > &scalarNames, const std::vector< tString > &vectorNames)
write a content header
Definition: SM_XDMF.h:258
const tFlag & getFormat() const
get the format of the data
Definition: SM_XDMF.h:143
tBoolean open(const tIndex &t)
open the vtk field for writing or appending at the time step
Definition: SM_XDMF.h:191
tBoolean open()
open the vtkfile
Definition: SM_XDMF.h:161
static CORE_UniquePointer< SM_XDMF > New(const tFlag &format)
create an XDMF class
Definition: SM_XDMF.h:79
void setExternalFileName(const tString &f)
set the external file to find the vector data
Definition: SM_XDMF.h:128
static tBoolean WriteField(CORE_OutputFile &file, const tFlag &fileType, const tString &linkHDFFile, const tIndex &t, const tFlag &contentType, const tString &name, const tString &tagName, const tReal &alpha, const tIndex &n, const tDimension &dim, const tReal *f)
write a field with name
Definition: SM_XDMF.cpp:198
static tBoolean WriteConnectivity(CORE_OutputFile &file, const tFlag &fileType, const tString &linkHDFFile, const tIndex &nAloneParticles, const tIndex &nHaloParticles, const std::valarray< tIndex > &neighboringParticlesListOffset, const std::valarray< tIndex > &neighboringParticlesList, const tString &tagN)
write the connectivity between vertices
Definition: SM_XDMF.cpp:85