55POIExportModule :: POIExportModule(
int n,
EngngModel *e) :
ExportModule(n, e), internalVarsToExport(), primaryVarsToExport(), POIList()
60POIExportModule :: ~POIExportModule()
68 ExportModule :: initializeFrom(ir);
79 std :: string poiFileName;
85POIExportModule :: readPOIFile(
const std :: string &poiFileName)
90 std :: ifstream file(poiFileName.c_str(), std :: ios :: in);
91 if ( !file.is_open() ) {
92 OOFEM_ERROR(
"Failed to open POI data file: %s\n. Did you specify poifilename?", poiFileName.c_str() );
97 while ( file >> poi.
id >> poi.
x >> poi.
y >> poi.
z >> poi.
region ) {
104POIExportModule :: doOutput(
TimeStep *tStep,
bool forcedOutput)
112 fprintf(stream,
"# POI DataFile\n");
113 fprintf( stream,
"Output for time %f\n", tStep->
giveTargetTime() );
122POIExportModule :: initialize()
124 ExportModule :: initialize();
129POIExportModule :: terminate()
134POIExportModule :: giveOutputStream(
TimeStep *tStep)
139 if ( ( answer = fopen(fileName.c_str(),
"w") ) == NULL ) {
140 OOFEM_ERROR(
"failed to open file %s", fileName.c_str() );
147POIExportModule :: exportIntVars(FILE *stream,
TimeStep *tStep)
159 poiCoords.
at(1) = poi.
x;
160 poiCoords.
at(2) = poi.
y;
161 poiCoords.
at(3) = poi.
z;
164 for ( i = 1; i <= n; i++ ) {
166 fprintf(stream,
"\n\nPOI_INTVAR_DATA %d\n", type);
183 toMap.
at(1) = ( int ) valID;
187 poiCoords.
at(1) = poi.x;
188 poiCoords.
at(2) = poi.y;
189 poiCoords.
at(3) = poi.z;
193 if ( !this->
giveMapper()->__mapVariable(val, poiCoords, valID, tStep) ) {
197 fprintf(stream,
"%10d ", poi.id);
198 for (
auto &x : val ) {
199 fprintf( stream,
" %15e", x );
202 fprintf(stream,
"\n");
208POIExportModule :: giveMapper()
212 this->
mapper = std::make_unique<MMAClosestIPTransfer>();
214 this->
mapper = std::make_unique<MMAShapeFunctProjection>();
216 this->
mapper = std::make_unique<MMALeastSquareProjection>();
222 return this->
mapper.get();
227POIExportModule :: exportPrimaryVars(FILE *stream,
TimeStep *tStep)
240 for (
int i = 1; i <= n; i++ ) {
254 if ( valID == DisplacementVector ) {
256 }
else if ( valID == FluxVector || valID == Humidity ) {
264 fprintf(stream,
"SCALARS prim_scalar_%d\n", (
int ) valID);
266 fprintf(stream,
"VECTORS vector_%d float\n", (
int ) valID);
275 coords.at(1) = poi.x;
276 coords.at(2) = poi.y;
277 coords.at(3) = poi.z;
285 fprintf(stream,
"%10d ", poi.id);
286 for (
auto &p : pv ) {
287 fprintf( stream,
" %15e ", p );
290 fprintf(stream,
"\n");
292 OOFEM_ERROR(
"no element containing POI(%e,%e,%e) found",
293 coords.at(1), coords.at(2), coords.at(3) );
#define REGISTER_ExportModule(class)
SpatialLocalizer * giveSpatialLocalizer()
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
virtual void computeField(ValueModeType mode, TimeStep *tStep, const FloatArray &lcoords, FloatArray &answer)
std::string giveOutputBaseFileName(TimeStep *tStep)
EngngModel * emodel
Problem pointer.
bool testTimeStepOutput(TimeStep *tStep)
void exportIntVars(FILE *stream, TimeStep *tStep)
MaterialMappingAlgorithm * giveMapper()
void exportPrimVarAs(UnknownType valID, FILE *stream, TimeStep *tStep)
void exportIntVarAs(InternalStateType valID, FILE *stream, TimeStep *tStep)
std ::unique_ptr< MaterialMappingAlgorithm > mapper
Mapper.
enum oofem::POIExportModule::POIEM_MapperType mtype
void exportPrimaryVars(FILE *stream, TimeStep *tStep)
IntArray primaryVarsToExport
List of primary unknowns to export.
POIEM_MapperType
Smoother type.
IntArray internalVarsToExport
List of InternalStateType values, identifying the selected vars for export.
void readPOIFile(const std ::string &poiFileName)
std ::list< POI_dataType > POIList
List of POIs.
FILE * giveOutputStream(TimeStep *tStep)
Returns the output stream for given solution step.
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
double giveTargetTime()
Returns target time.
#define OOFEM_WARNING(...)
InternalStateValueType
Determines the type of internal variable.
@ ISVT_UNDEFINED
Undefined.
#define _IFT_POIExportModule_vars
#define _IFT_POIExportModule_mtype
#define _IFT_POIExportModule_primvars
#define _IFT_POIExportModule_poifilename