Skip to content

Commit

Permalink
add limawriter in classic mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslg committed Aug 30, 2024
1 parent d95b045 commit cd26596
Show file tree
Hide file tree
Showing 6 changed files with 1,402 additions and 691 deletions.
2 changes: 2 additions & 0 deletions io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ endif()
if(WITH_LIMA)
find_package(Lima REQUIRED)
list(APPEND GMDS_INC
inc/gmds/io/LimaWriterStreamMli2.h
inc/gmds/io/LimaWriter.h
inc/gmds/io/LimaReader.h)
list(APPEND GMDS_SRC
src/LimaWriterStreamMli2.cpp
src/LimaWriter.cpp
src/LimaReader.cpp)

Expand Down
57 changes: 15 additions & 42 deletions io/inc/gmds/io/LimaWriter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*----------------------------------------------------------------------------*/
#ifndef GMDS_LIMA_WRITER_API_H
#define GMDS_LIMA_WRITER_API_H
#ifndef GMDS_LIMA_WRITER_H
#define GMDS_LIMA_WRITER_H
/*----------------------------------------------------------------------------*/
#include <map>
#include <sstream>
Expand All @@ -9,7 +9,7 @@
#include <gmds/ig/Mesh.h>
#include "GMDSIo_export.h"
/*----------------------------------------------------------------------------*/
#include <Lima/malipp2.h>
#include <Lima/lima++.h>
/*----------------------------------------------------------------------------*/
namespace gmds {

Expand Down Expand Up @@ -37,57 +37,30 @@ class GMDSIo_API LimaWriter
*/
void write(const std::string &AFileName, MeshModel AModel, int ACompact = false);

/*------------------------------------------------------------------------*/
/** \brief Activate the zlib compression.
*/
void activateZlibCompression();

private:
void writeNodes();
void writeEdges();
void writeFaces();
void writeRegions();

void writeClouds();
void writeLines();
void writeSurfaces();
void writeVolumes();
void writeClassic(const std::string &AFileName, MeshModel AModel, int ACompact = false);

void writeNodesAttributes();
void writeEdgesAttributes();
void writeFacesAttributes();
void writeRegionsAttributes();
void writeNodes(Lima::Maillage& ALimaMesh);
void writeEdges(Lima::Maillage& ALimaMesh);
void writeFaces(Lima::Maillage& ALimaMesh);
void writeRegions(Lima::Maillage& ALimaMesh);

void writeCloudsAttributes();
void writeLinesAttributes();
void writeSurfacesAttributes();
void writeVolumesAttributes();
// void writeClouds();
// void writeLines();
// void writeSurfaces();
// void writeVolumes();

/**@brief Check if the node ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousNodes();
/**@brief Check if the edge ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousEdges();
/**@brief Check if the face ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousFaces();
/**@brief Check if the region ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousRegions();
private:
/* a mesh */
gmds::Mesh &m_mesh;

/* length unit */
double m_length_unit;

Lima::MaliPPWriter2 *m_writer;
/* connection between original nodes ID and lima nodes */
std::vector<Lima::Noeud> m_nodes_connection;
};
}
/*----------------------------------------------------------------------------*/
#endif //GMDS_LIMAWRITER_API_H
#endif //GMDS_LIMA_WRITER_H
93 changes: 93 additions & 0 deletions io/inc/gmds/io/LimaWriterStreamMli2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*----------------------------------------------------------------------------*/
#ifndef GMDS_LIMA_WRITER_STREAM_MLI2_H
#define GMDS_LIMA_WRITER_STREAM_MLI2_H
/*----------------------------------------------------------------------------*/
#include <map>
#include <sstream>
/*----------------------------------------------------------------------------*/
// headers of GMDS files
#include <gmds/ig/Mesh.h>
#include "GMDSIo_export.h"
/*----------------------------------------------------------------------------*/
#include <Lima/malipp2.h>
/*----------------------------------------------------------------------------*/
namespace gmds {

class GMDSIo_API LimaWriterStreamMli2
{
public:
/*------------------------------------------------------------------------*/
/** \brief Constructor.
*
* \param AMesh the mesh we want to write into a file.
*/
LimaWriterStreamMli2(Mesh &AMesh);

/*------------------------------------------------------------------------*/
/** \brief Destructor. */
virtual ~LimaWriterStreamMli2();

/*------------------------------------------------------------------------*/
/** \brief Set the mesh length unit. It is the conversion factor from meters
*/
void setLengthUnit(double AUnit);

/*------------------------------------------------------------------------*/
/** \brief Write the content of mesh_ into the file named AFileName.
*/
void write(const std::string &AFileName, MeshModel AModel, int ACompact = false);

/*------------------------------------------------------------------------*/
/** \brief Activate the zlib compression.
*/
void activateZlibCompression();

private:
void writeNodes();
void writeEdges();
void writeFaces();
void writeRegions();

void writeClouds();
void writeLines();
void writeSurfaces();
void writeVolumes();

void writeNodesAttributes();
void writeEdgesAttributes();
void writeFacesAttributes();
void writeRegionsAttributes();

void writeCloudsAttributes();
void writeLinesAttributes();
void writeSurfacesAttributes();
void writeVolumesAttributes();

/**@brief Check if the node ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousNodes();
/**@brief Check if the edge ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousEdges();
/**@brief Check if the face ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousFaces();
/**@brief Check if the region ids are continuously ordered and
* initialized the MaliPPWriter2 accordingly.
*/
void checkContinuousRegions();
private:
/* a mesh */
gmds::Mesh &m_mesh;

/* length unit */
double m_length_unit;

Lima::MaliPPWriter2 *m_writer;
};
}
/*----------------------------------------------------------------------------*/
#endif //GMDS_LIMA_WRITER_STREAM_MLI2_H
Loading

0 comments on commit cd26596

Please sign in to comment.