Commit 5230450c authored by Benoît LÉ's avatar Benoît LÉ

[xExport] Modified xPostProcessingManager API

In the previous version, the values of some labels coming from the xParseData
where imposed (so basically xPostProcessingManager could not work if some
particular labels were not defined in the xParseData). The API has been modified
to be usable with any custome labels.
parent 9d23f1fd
......@@ -14,17 +14,39 @@ using namespace std;
using namespace xfem;
using namespace xexport;
xPostProcessingManager::xPostProcessingManager(const xParseData& parse_data_, xexport::xExport& pexport_, xEntityFilter filter)
: parse_data(parse_data_), export_manager(GetNbDigits(parse_data.getInt("nb_step_max"))), filter(filter), pexport(pexport_)
int GetNbDigits(int nb)
{
export_manager.init(parse_data, "export_manager");
if (nb < 0)
{
return 1;
}
int digits = 0;
while (nb)
{
nb /= 10;
++digits;
}
return digits;
}
xPostProcessingManager::xPostProcessingManager(xexport::xExport& pexport_, xEntityFilter filter)
: filter(filter), pexport(pexport_)
{
}
void xPostProcessingManager::initExportManager(const xParseData& parse_data_, std::string export_manager_label,
const int nb_step_max)
{
export_manager.init(parse_data_, export_manager_label);
export_manager.setNumerationSize(GetNbDigits(nb_step_max));
}
void xPostProcessingManager::init(xMesh& mesh)
void xPostProcessingManager::initSensors(xfem::xMesh& mesh, const xParseData& parse_data_, std::string export_sensors_label,
std::string export_sensors_point)
{
sensor_manager.init(parse_data, &mesh, 2, "export_sensors_label", "export_sensors_point");
sensor_manager.init(parse_data_, &mesh, 2, export_sensors_label, export_sensors_point);
}
void xPostProcessingManager::reinit(xMesh& mesh) { sensor_manager.reinit(&mesh); }
void xPostProcessingManager::reinitMesh(xMesh& mesh) { sensor_manager.reinit(&mesh); }
bool xPostProcessingManager::toExport(const std::string export_name) { return sensor_manager.toExport(export_name); }
......
......@@ -14,33 +14,16 @@
#include "xField.h"
#include "xSensors.h"
inline int GetNbDigits(int nb)
{
if (nb < 0)
{
return 1;
}
int digits = 0;
while (nb)
{
nb /= 10;
++digits;
}
return digits;
}
namespace xexport
{
class xPostProcessingManager
{
public:
xPostProcessingManager(const xParseData &, xexport::xExport &, xfem::xEntityFilter = xfem::xAcceptAll());
// init and reinit xfem::xGeomElem used by xexport::xSensors to measure.
void init(xfem::xMesh &);
void reinit(xfem::xMesh &);
xPostProcessingManager(xexport::xExport &, xfem::xEntityFilter = xfem::xAcceptAll());
void createCurvesPlotFiles(std::string);
void initExportManager(const xParseData &, std::string, const int);
void initSensors(xfem::xMesh &, const xParseData &, std::string, std::string);
void reinitMesh(xfem::xMesh &);
bool toExport(const std::string export_name);
bool toExport(const std::string export_name, const int step, const std::string &extension_name = "");
......@@ -172,7 +155,6 @@ class xPostProcessingManager
pexport.closeFile();
}
const xParseData &parse_data;
xexport::xExportManager export_manager;
xexport::xExportSensors sensor_manager;
xexport::xExport &pexport;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment