/
SpudBucket.h
178 lines (123 loc) · 10 KB
/
SpudBucket.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// 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 __SPUD_BUCKET_H
#define __SPUD_BUCKET_H
#include "Bucket.h"
#include "BoostTypes.h"
#include <dolfin.h>
namespace buckettools
{
//*****************************************************************|************************************************************//
// SpudBucket class:
//
// The SpudBucket derived class uses the data structures of the Bucket class,
// which describes a numerical model, and populates them (plus some supplementary
// material) using the spud options parser.
//*****************************************************************|************************************************************//
class SpudBucket : public Bucket
{
//*****************************************************************|***********************************************************//
// Publicly available functions
//*****************************************************************|***********************************************************//
public: // accessible to everyone
//***************************************************************|***********************************************************//
// Constructors and destructors
//***************************************************************|***********************************************************//
SpudBucket(); // Default constructor
SpudBucket(const std::string &name); // Specific constructor (specifying name)
SpudBucket(const std::string &name,
const std::string &optionpath); // Specific constructor (specifying name and optionpath)
~SpudBucket(); // Default destructor
//***************************************************************|***********************************************************//
// Filling data
//***************************************************************|***********************************************************//
void fill(); // fill the bucket data structures assuming the buckettools
// spud schema
//***************************************************************|***********************************************************//
// Base data access
//***************************************************************|***********************************************************//
const std::string optionpath() // return the optionpath for this bucket
{ return optionpath_; } // (normally an empty string)
//***************************************************************|***********************************************************//
// Mesh data access
//***************************************************************|***********************************************************//
void register_mesh(Mesh_ptr mesh, const std::string &name, // register a mesh with a given name (and an optionpath)
std::string optionpath,
MeshFunction_size_t_ptr celldomains = MeshFunction_size_t_ptr(),
MeshFunction_size_t_ptr facetdomains = MeshFunction_size_t_ptr());
std::string fetch_mesh_optionpath(const std::string &name); // return the optionpath associated with the named mesh
string_it mesh_optionpaths_begin(); // return an iterator to the beginning of the mesh optionpaths
string_const_it mesh_optionpaths_begin() const; // return a constant iterator to the beginning of the mesh
// optionpaths
string_it mesh_optionpaths_end(); // return an iterator to the end of the mesh optionpaths
string_const_it mesh_optionpaths_end() const; // return a constant iterator to the end of the mesh
// optionpaths
//***************************************************************|***********************************************************//
// Detector data access
//***************************************************************|***********************************************************//
void register_detector(GenericDetectors_ptr detector, // register a detector with a given name (and an optionpath)
const std::string &name,
std::string option_path);
std::string fetch_detector_optionpath(const std::string &name); // return the optionpath associated with the named detector
string_it detector_optionpaths_begin(); // return an iterator to the beginning of the detector optionpaths
string_const_it detector_optionpaths_begin() const; // return a constant iterator to the beginning of the detector
// optionpaths
string_it detector_optionpaths_end(); // return an iterator to the end of the detector optionpaths
string_const_it detector_optionpaths_end() const; // return a constant iterator to the end of the detector
// optionpaths
//***************************************************************|***********************************************************//
// Output functions
//***************************************************************|***********************************************************//
const std::string meshes_str(const int &indent=0) const; // return an indented string describing the meshes
const std::string detectors_str(const int &indent=0) const; // return an indented string describing the meshes
//*****************************************************************|***********************************************************//
// Private functions
//*****************************************************************|***********************************************************//
private: // only accessible to this class
//***************************************************************|***********************************************************//
// Base data
//***************************************************************|***********************************************************//
std::string optionpath_; // the option path associated with the bucket (normally an
// empty string)
//***************************************************************|***********************************************************//
// Pointers data
//***************************************************************|***********************************************************//
ordered_map< const std::string, std::string > mesh_optionpaths_; // a map from mesh names to spud mesh optionpaths
ordered_map< const std::string, std::string > detector_optionpaths_; // a map from detector names to spud detector optionpaths
//***************************************************************|***********************************************************//
// Filling data (continued)
//***************************************************************|***********************************************************//
void fill_globalparameters_() const; // fill the global parameters
void fill_timestepping_(); // fill the timestepping data
void fill_adaptivetimestepping_(); // fill the timestepping data
void fill_output_(); // fill the output data
void fill_meshes_(const std::string &optionpath); // fill in the mesh data structures
void fill_systems_(const std::string &optionpath); // fill in information about the systems
void fill_baseuflsymbols_(const std::string &optionpath); // fill the ufl symbol maps
void fill_detectors_(); // fill the detectors
void fill_diagnostics_(); // fill the detectors
//***************************************************************|***********************************************************//
// Output functions
//***************************************************************|***********************************************************//
void checkpoint_options_(const double_ptr time); // checkpoint the options system for the bucket
};
typedef std::shared_ptr< SpudBucket > SpudBucket_ptr; // define a boost shared pointer type for this class
}
#endif