/
SteadyStateFile.h
119 lines (88 loc) · 6.12 KB
/
SteadyStateFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Copyright (C) 2013 Columbia University in the City of New York and others.
//
// Please see the AUTHORS file in the main source directory for a full list
// of contributors.
//
// This file is part of TerraFERMA.
//
// TerraFERMA is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// TerraFERMA is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TerraFERMA. If not, see <http://www.gnu.org/licenses/>.
#ifndef __STEADYSTATE_FILE_H
#define __STEADYSTATE_FILE_H
#include <cstdio>
#include <fstream>
#include <string>
#include "DiagnosticsFile.h"
#include "BoostTypes.h"
namespace buckettools
{
//*****************************************************************|************************************************************//
// predeclarations: a circular dependency between the SteadyStateFile class and the Bucket class requires a lot of predeclarations.
//*****************************************************************|************************************************************//
class Bucket;
class FunctionBucket;
typedef std::shared_ptr< FunctionBucket > FunctionBucket_ptr;
typedef std::shared_ptr< dolfin::Form > Form_ptr;
//*****************************************************************|************************************************************//
// SteadyStateFile class:
//
// A derived class from the base statfile class intended for the output of diagnostics to file every dump period.
// Statistics normally include things like function mins and maxes as well as functional output.
//*****************************************************************|************************************************************//
class SteadyStateFile : public DiagnosticsFile
{
//*****************************************************************|***********************************************************//
// Publicly available functions
//*****************************************************************|***********************************************************//
public: // available to everyone
//***************************************************************|***********************************************************//
// Constructors and destructors
//***************************************************************|***********************************************************//
SteadyStateFile(const std::string &name,
const MPI_Comm &comm,
const Bucket *bucket); // specific constructor
~SteadyStateFile(); // default destructor
//***************************************************************|***********************************************************//
// Header writing functions
//***************************************************************|***********************************************************//
void write_header(); // write header for the bucket
//***************************************************************|***********************************************************//
// Data writing functions
//***************************************************************|***********************************************************//
void write_data(); // write data to file for a simulation
//*****************************************************************|***********************************************************//
// Private functions
//*****************************************************************|***********************************************************//
private: // only available to this class
//***************************************************************|***********************************************************//
// Base data
//***************************************************************|***********************************************************//
std::vector< FunctionBucket_ptr > functions_;
std::vector< FunctionalBucket_ptr > functionals_;
//***************************************************************|***********************************************************//
// Header writing functions (continued)
//***************************************************************|***********************************************************//
void header_bucket_(); // write the header for the bucket (non-constant and
// timestepping entries)
void header_func_(const FunctionBucket_ptr f_ptr); // write the header for a set of functions
void header_functional_(const FunctionalBucket_ptr f_ptr); // write the header for a set of functionals of a function
//***************************************************************|***********************************************************//
// Data writing functions (continued)
//***************************************************************|***********************************************************//
void data_bucket_(); // write the data for a steady state simulation
void data_func_(FunctionBucket_ptr f_ptr); // write the data for a set of functions
void data_functional_(FunctionalBucket_ptr f_ptr); // write the data for a set of functionals
};
typedef std::shared_ptr< SteadyStateFile > SteadyStateFile_ptr; // define a boost shared ptr type for the class
}
#endif