20 #ifndef _FCST_FUELCELLSHOP_SOLUTION_VARIABLE_H_
21 #define _FCST_FUELCELLSHOP_SOLUTION_VARIABLE_H_
27 #include <deal.II/base/point.h>
28 #include <deal.II/base/function.h>
29 #include <deal.II/lac/vector.h>
30 #include <deal.II/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;
137 default_data = data_in;
140 initialized_default_data =
true;
141 initialized_data =
false;
154 Assert( initialized_default_data, ExcMessage(
"default_data is not initialized") );
163 Assert( initialized_data, ExcMessage(
"data is not initialized") );
172 Assert( initialized, ExcMessage(
"SolutionVariable not initialized !!!") );
186 return initialized_default_data;
191 return initialized_data;
199 unsigned int answer = 0;
201 if (initialized && (data != NULL))
202 answer = data->size();
203 else if (initialized && (data == NULL))
204 answer = default_data.size();
220 Assert( initialized, ExcMessage(
"SolutionVariables struct is not initialized !!!") );
224 Assert( i < data->size(), ExcMessage(
"Index is out of range in operator[] for SolutionVariables struct.") );
227 else if (data == NULL)
229 Assert( i < default_data.size(), ExcMessage(
"Index is out of range in operator[] for SolutionVariables struct.") );
230 return default_data.at(i);
246 std::vector<double> tmp(left.
size());
252 for(
unsigned int q = 0; q < tmp.size(); ++q)
255 for(
unsigned int q = 0; q < tmp.size(); ++q)
263 AssertThrow(
false, ExcNotImplemented() );
267 AssertThrow(
false, ExcInternalError() );
283 std::vector<double> tmp(right.
size());
289 for(
unsigned int q = 0; q < tmp.size(); ++q)
292 for(
unsigned int q = 0; q < tmp.size(); ++q)
300 AssertThrow(
false, ExcNotImplemented() );
304 AssertThrow(
false, ExcInternalError() );
320 std::vector<double> tmp(left.
size());
326 for(
unsigned int q = 0; q < tmp.size(); ++q)
329 for(
unsigned int q = 0; q < tmp.size(); ++q)
337 AssertThrow(
false, ExcNotImplemented() );
341 AssertThrow(
false, ExcInternalError() );
366 const std::vector<double>*
data;
457 class SolutionMap :
private std::map< VariableNames, SolutionVariable>
479 throw std::runtime_error(
"You have already added a SolutionVariable of corresponding VariableNames type to SolutionMap");
490 return std::map<VariableNames, SolutionVariable>::at(key);
497 std::map<VariableNames, SolutionVariable>::clear();
504 std::map<VariableNames, SolutionVariable>::erase(v);
514 if(this->count(v) >0)
525 std::map<VariableNames, SolutionVariable>::erase(v);
const std::vector< double > * get_data() const
Definition: fcst_variables.h:161
void clear()
Expose std::map<VariableNames, SolutionVariable>::clear() interface publicly.
Definition: fcst_variables.h:496
bool has(const VariableNames &v) const
Find if a solution corresponding VariableNames type exist inside map.
Definition: fcst_variables.h:511
void erase(const VariableNames &v)
Expose std::map<VariableNames, SolutionVariable>::erase() interface publicly.
Definition: fcst_variables.h:503
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:218
VariableNames get_variablename() const
Function to get the VariableNames enumeration corresponding to this struct.
Definition: fcst_variables.h:170
VariableNames name
FCST variable name stored in VariableNames enumeration.
Definition: fcst_variables.h:371
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:63
Convenient storage object for SolutionVariables.
Definition: fcst_variables.h:457
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:71
SolutionVariable pop(const VariableNames &v)
Returns and entry whilst removing it from the list.
Definition: fcst_variables.h:523
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:474
const bool is_default_data_initialized() const
Definition: fcst_variables.h:184
std::vector< double > default_data
Constant data.
Definition: fcst_variables.h:358
const std::vector< double > & get_default_data() const
Return a reference to the default_data stored in the class.
Definition: fcst_variables.h:152
const bool is_data_initialized() const
Definition: fcst_variables.h:189
bool initialized_default_data
true if default_data is initialized.
Definition: fcst_variables.h:383
SolutionVariable & at(VariableNames key)
Expose std::map<VariableNames, SolutionVariable>::at() interface publicly.
Definition: fcst_variables.h:489
bool initialized
true if either default_data or data is initialized.
Definition: fcst_variables.h:377
unsigned int size() const
Function to the length of the internal data element.
Definition: fcst_variables.h:197
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:409
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:366
Definition: system_management.h:72
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:401
bool initialized_data
true if data is initialized.
Definition: fcst_variables.h:389
const bool is_initialized() const
Function to determine whether the structure is initialized or not.
Definition: fcst_variables.h:179
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:134