OOFEM 3.0
Loading...
Searching...
No Matches
outputexportmodule.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#include <vector>
36#include <cstdio>
37
38#include "oofemcfg.h"
39#include "outputexportmodule.h"
40#include "engngm.h"
41#include "domain.h"
42#include "node.h"
43#include "element.h"
44#include "timestep.h"
45#include "classfactory.h"
46
47namespace oofem {
49
50OutputExportModule :: OutputExportModule(int n, EngngModel *e) : ExportModule(n, e), outputStream(NULL)
51{
52}
53
54void
55OutputExportModule :: initializeFrom(InputRecord &ir)
56{
57 nodeSets.clear();
59 elementSets.clear();
61
62 ExportModule :: initializeFrom(ir);
63
64 auto *file = giveOutputStream();
65
66 fprintf(file, "%s", PRG_HEADER);
67 fprintf(file, "\nStarting analysis on: %s\n", ctime(& emodel->giveStartTime()) );
68 fprintf(file, "%s\n", emodel->giveDescription().c_str());
69}
70
71FILE *
72OutputExportModule :: giveOutputStream()
73{
74 if ( this->outputStream ) return this->outputStream;
75 this->outputStream = fopen(emodel->giveOutputBaseFileName().c_str(), "w");
76 if ( !this->outputStream ) {
77 OOFEM_ERROR("Can't open output file %s", emodel->giveOutputBaseFileName().c_str());
78 }
79 return this->outputStream;
80}
81
82void
83OutputExportModule :: doOutput(TimeStep *tStep, bool forcedOutput)
84{
85 if ( !( testTimeStepOutput(tStep) || forcedOutput ) ) {
86 return;
87 }
88
89 FILE *file = this->giveOutputStream();
90
91 fprintf(file, "\n==============================================================");
92 fprintf(file, "\nOutput for time %.8e ", tStep->giveTargetTime() * emodel->giveVariableScale(VST_Time) );
93 fprintf(file, "\n==============================================================\n");
94
95 emodel->printOutputAt(file, tStep, nodeSets, elementSets);
96
97 fprintf(file, "\nUser time consumed by solution step %d: %.3f [s]\n\n", tStep->giveNumber(), emodel->giveSolutionStepTime());
98}
99
100void
101OutputExportModule :: terminate()
102{
103 FILE *out = this->giveOutputStream();
104 int rhrs, rmin, rsec, uhrs, umin, usec;
105 time_t endTime = time(NULL);
106
107 emodel->giveAnalysisTime(rhrs, rmin, rsec, uhrs, umin, usec);
108
109 fprintf(out, "\nFinishing analysis on: %s\n", ctime(& endTime) );
110 fprintf(out, "Real time consumed: %03dh:%02dm:%02ds\n", rhrs, rmin, rsec);
111 fprintf(out, "User time consumed: %03dh:%02dm:%02ds\n\n\n", uhrs, umin, usec);
112}
113
114} // end namespace oofem
#define REGISTER_ExportModule(class)
EngngModel * emodel
Problem pointer.
bool testTimeStepOutput(TimeStep *tStep)
IntArray elementSets
Set which contains elements which should be exported.
IntArray nodeSets
Set which contains nodes which should be exported.
double giveTargetTime()
Returns target time.
Definition timestep.h:164
int giveNumber()
Returns receiver's number.
Definition timestep.h:144
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
OOFEM_EXPORT const char * PRG_HEADER
Definition oofemcfg.C:22
#define _IFT_OutputExportModule_elementSets
#define _IFT_OutputExportModule_nodeSets

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011