9 #ifndef field_algo_base_IMPL_HH_
10 #define field_algo_base_IMPL_HH_
34 template <
int spacedim,
class Value>
37 component_idx_(
std::numeric_limits<unsigned int>::max())
44 template <
int spacedim,
class Value>
46 return boost::str(boost::format(
"R%i -> %s") % spacedim % Value::type_name() );
51 template <
int spacedim,
class Value>
53 =
it::AbstractRecord(
"Field:"+template_name(),
"Abstract record for all time-space functions.")
58 template <
int spacedim,
class Value>
76 template <
int spacedim,
class Value>
77 shared_ptr< FieldAlgorithmBase<spacedim, Value> >
80 shared_ptr< FieldAlgorithmBase<spacedim, Value> > func;
83 func=make_shared< FieldInterpolatedP0<spacedim,Value> >(n_comp);
86 func=make_shared< FieldPython<spacedim, Value> >(n_comp);
89 func=make_shared< FieldConstant<spacedim,Value> >(n_comp);
91 func=make_shared< FieldFormula<spacedim,Value> >(n_comp);
93 func=make_shared< FieldElementwise<spacedim,Value> >(n_comp);
95 xprintf(
PrgErr,
"TYPE of Field is out of set of descendants. SHOULD NOT HAPPEN.\n");
97 func->init_from_input(rec);
103 template <
int spacedim,
class Value>
105 xprintf(
PrgErr,
"The field '%s' do not support initialization from input.\n",
106 typeid(
this).name());
111 template <
int spacedim,
class Value>
119 template <
int spacedim,
class Value>
125 template<
int spacedim,
class Value>
127 return (Value::NRows_ ? 0 : value_.n_rows());
132 template<
int spacedim,
class Value>
139 for(
unsigned int i=0; i< point_list.size(); i++) {
140 ASSERT( Value(value_list[i]).n_rows()==this->value_.n_rows(),
141 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
142 i, Value(value_list[i]).n_rows(),this->value_.n_rows());
143 value_list[i]=this->value(point_list[i], elm);
156 #define INSTANCE_DIM_DEP_VALUES( field, dim_from, dim_to) \
157 template class field<dim_from, FieldValue<dim_to>::VectorFixed >; \
158 template class field<dim_from, FieldValue<dim_to>::TensorFixed >; \
161 #define INSTANCE_TO_ALL(field, dim_from) \
162 template class field<dim_from, FieldValue<0>::Enum >; \
163 template class field<dim_from, FieldValue<0>::EnumVector >; \
164 template class field<dim_from, FieldValue<0>::Integer >; \
165 template class field<dim_from, FieldValue<0>::Scalar >; \
166 template class field<dim_from, FieldValue<0>::Vector >; \
168 INSTANCE_DIM_DEP_VALUES( field, dim_from, 2) \
169 INSTANCE_DIM_DEP_VALUES( field, dim_from, 3) \
174 #define INSTANCE_ALL(field) \
175 INSTANCE_TO_ALL( field, 3) \
176 INSTANCE_TO_ALL( field, 2)
182 #endif //FUNCTION_BASE_IMPL_HH_
static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit)
virtual bool set_time(const TimeStep &time)
static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit)
static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit)
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)=0
Basic time management class.
static Input::Type::AbstractRecord get_input_type(const typename Value::ElementInputType *element_input_type=nullptr)
#define ASSERT_EQUAL(a, b)
static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit)
static std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > function_factory(const Input::AbstractRecord &rec, unsigned int n_comp=0)
FieldAlgorithmBase(unsigned int n_comp=0)
Value value_
Last value, prevents passing large values (vectors) by value.
virtual void set_mesh(const Mesh *mesh, bool boundary_domain)
static std::string template_name()
Representation of one time step.
unsigned int n_comp() const
virtual void init_from_input(const Input::Record &rec)