21 #ifndef _FCST_FUELCELLSHOP_SOLUTION_VARIABLE_H_
22 #define _FCST_FUELCELLSHOP_SOLUTION_VARIABLE_H_
27 #include <base/parameter_handler.h>
28 #include <base/point.h>
29 #include <base/function.h>
30 #include <lac/vector.h>
31 #include <fe/fe_values.h>
35 using namespace dealii;
37 namespace FuelCellShop
97 initialized_default_data =
false;
98 initialized_data =
false;
109 initialized_default_data =
false;
110 initialized_data =
true;
121 default_data = std::vector<double>(length, value);
124 initialized_default_data =
true;
125 initialized_data =
false;
136 default_data = data_in;
139 initialized_default_data =
true;
140 initialized_data =
false;
150 Assert( initialized_default_data, ExcMessage(
"default_data is not initialized") );
156 Assert( initialized_data, ExcMessage(
"data is not initialized") );
165 Assert( initialized, ExcMessage(
"SolutionVariable not initialized !!!") );
179 return initialized_default_data;
184 return initialized_data;
192 unsigned int answer = 0;
194 if (initialized && (data != NULL))
195 answer = data->size();
196 else if (initialized && (data == NULL))
197 answer = default_data.size();
213 Assert( initialized, ExcMessage(
"SolutionVariables struct is not initialized !!!") );
217 Assert( i < data->size(), ExcMessage(
"Index is out of range in operator[] for SolutionVariables struct.") );
220 else if (data == NULL)
222 Assert( i < default_data.size(), ExcMessage(
"Index is out of range in operator[] for SolutionVariables struct.") );
223 return default_data.at(i);
239 std::vector<double> tmp(left.
size());
245 for(
unsigned int q = 0; q < tmp.size(); ++q)
248 for(
unsigned int q = 0; q < tmp.size(); ++q)
256 AssertThrow(
false, ExcNotImplemented() );
260 AssertThrow(
false, ExcInternalError() );
276 std::vector<double> tmp(right.
size());
282 for(
unsigned int q = 0; q < tmp.size(); ++q)
285 for(
unsigned int q = 0; q < tmp.size(); ++q)
293 AssertThrow(
false, ExcNotImplemented() );
297 AssertThrow(
false, ExcInternalError() );
313 std::vector<double> tmp(left.
size());
319 for(
unsigned int q = 0; q < tmp.size(); ++q)
322 for(
unsigned int q = 0; q < tmp.size(); ++q)
330 AssertThrow(
false, ExcNotImplemented() );
334 AssertThrow(
false, ExcInternalError() );
355 const std::vector<double>*
data;
447 class SolutionMap :
private std::map< VariableNames, SolutionVariable>
469 throw std::runtime_error(
"You have already added a SolutionVariable of corresponding VariableNames type to SolutionMap");
480 return std::map<VariableNames, SolutionVariable>::at(key);
487 std::map<VariableNames, SolutionVariable>::clear();
494 std::map<VariableNames, SolutionVariable>::erase(v);
504 if(this->count(v) >0)
516 std::map<VariableNames, SolutionVariable>::erase(v);
const std::vector< double > * get_data() const
Definition: fcst_variables.h:154
void clear()
Expose std::map<VariableNames, SolutionVariable>::clear() interface publicly.
Definition: fcst_variables.h:486
bool has(const VariableNames &v) const
Find if a solution corresponding VariableNames type exist inside map.
Definition: fcst_variables.h:501
void erase(const VariableNames &v)
Expose std::map<VariableNames, SolutionVariable>::erase() interface publicly.
Definition: fcst_variables.h:493
const double & operator[](const unsigned int &i) const
Operator to access the value at a particular quadrature point in the cell.
Definition: fcst_variables.h:211
VariableNames get_variablename() const
Function to get the VariableNames enumeration corresponding to this struct.
Definition: fcst_variables.h:163
VariableNames name
FCST variable name stored in VariableNames enumeration.
Definition: fcst_variables.h:361
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:62
Convenient storage object for SolutionVariables.
Definition: fcst_variables.h:447
This structure is used to encapsulate data from constant values and variable solution data that is us...
Definition: fcst_variables.h:86
Definition: system_management.h:70
SolutionVariable pop(const VariableNames &v)
Returns and entry whilst removing it from the list.
Definition: fcst_variables.h:514
SolutionVariable(const std::vector< double > *data_in, const VariableNames &name_in)
Constructor for setting up the pointer to solution variable values and name of the solution variable...
Definition: fcst_variables.h:104
void push_back(const SolutionVariable &a)
Public function for adding SolutionVariable, uses the VariableNames stored within the SolutionVariabl...
Definition: fcst_variables.h:464
const bool is_default_data_initialized() const
Definition: fcst_variables.h:177
std::vector< double > default_data
Constant data.
Definition: fcst_variables.h:349
const std::vector< double > & get_default_data() const
Definition: fcst_variables.h:148
const bool is_data_initialized() const
Definition: fcst_variables.h:182
bool initialized_default_data
true if default_data is initialized.
Definition: fcst_variables.h:373
SolutionVariable & at(VariableNames key)
Expose std::map<VariableNames, SolutionVariable>::at() interface publicly.
Definition: fcst_variables.h:479
bool initialized
true if either default_data or data is initialized.
Definition: fcst_variables.h:367
unsigned int size() const
Function to the length of the internal data element.
Definition: fcst_variables.h:190
static bool is_phiS(const SolutionVariable &sol_var)
Unary Predicate to return true if a SolutionVariable object belongs to electronic_electrical_potentia...
Definition: fcst_variables.h:399
SolutionVariable(const double &value, const unsigned int &length, const VariableNames &name_in)
Constructor to initialize the solution variable values, taking a default value and size of the vector...
Definition: fcst_variables.h:118
SolutionVariable()
Default Constructor.
Definition: fcst_variables.h:93
const std::vector< double > * data
Data in quadrature points of a mesh entity.
Definition: fcst_variables.h:355
Definition: system_management.h:71
static bool is_phiM(const SolutionVariable &sol_var)
Unary Predicate to return true if a SolutionVariable object belongs to protonic_electrical_potential...
Definition: fcst_variables.h:391
bool initialized_data
true if data is initialized.
Definition: fcst_variables.h:379
const bool is_initialized() const
Function to determine whether the structure is initialized or not.
Definition: fcst_variables.h:172
SolutionVariable(const std::vector< double > &data_in, const VariableNames &name_in)
Constructor to initialize the solution variable values, taking values as an input vector argument...
Definition: fcst_variables.h:133