18 #ifndef field_algo_base_IMPL_HH_
19 #define field_algo_base_IMPL_HH_
40 namespace it = Input::Type;
49 template <
int spacedim,
class Value>
53 component_idx_(std::numeric_limits<unsigned int>::max())
60 template <
int spacedim,
class Value>
62 return boost::str(
boost::format(
"R%i -> %s") % spacedim % Value::type_name() );
67 template <
int spacedim,
class Value>
70 ss <<
"[" << Value::NRows_ <<
", " << Value::NCols_ <<
"]";
71 return it::Abstract(
"Field:"+template_name(),
"Abstract for all time-space functions.")
79 template <
int spacedim,
class Value>
84 param_vec.push_back( std::make_pair(
"element_input_type", std::make_shared<it::Selection>(value_selection)) );
86 param_vec.push_back( std::make_pair(
"element_input_type", std::make_shared<typename Value::ElementInputType>()) );
94 template <
int spacedim,
class Value>
95 shared_ptr< FieldAlgorithmBase<spacedim, Value> >
98 shared_ptr< FieldAlgorithmBase<spacedim, Value> > func;
106 template <
int spacedim,
class Value>
108 xprintf(
PrgErr,
"The field '%s' do not support initialization from input.\n",
109 typeid(
this).name());
114 template <
int spacedim,
class Value>
122 template <
int spacedim,
class Value>
128 template<
int spacedim,
class Value>
130 return (Value::NRows_ ? 0 : value_.n_rows());
135 template<
int spacedim,
class Value>
141 ASSERT_EQ( point_list.size(), value_list.size() ).error();
142 for(
unsigned int i=0; i< point_list.size(); i++) {
143 ASSERT( Value(value_list[i]).n_rows()==this->value_.n_rows() )(i)(Value(value_list[i]).n_rows())(this->value_.n_rows())
144 .error(
"value_list has wrong number of rows");
145 value_list[i]=this->value(point_list[i], elm);
158 #define INSTANCE_DIM_DEP_VALUES( field, dim_from, dim_to) \
159 template class field<dim_from, FieldValue<dim_to>::VectorFixed >; \
160 template class field<dim_from, FieldValue<dim_to>::TensorFixed >; \
163 #define INSTANCE_TO_ALL(field, dim_from) \
164 template class field<dim_from, FieldValue<0>::Enum >; \
165 template class field<dim_from, FieldValue<0>::Integer >; \
166 template class field<dim_from, FieldValue<0>::Scalar >; \
168 INSTANCE_DIM_DEP_VALUES( field, dim_from, dim_from) \
174 #define INSTANCE_ALL(field) \
175 INSTANCE_TO_ALL( field, 3) \
176 INSTANCE_TO_ALL( field, 2)
182 #endif //FUNCTION_BASE_IMPL_HH_
static const Input::Type::Instance & get_input_type_instance(Input::Type::Selection value_selection=Input::Type::Selection())
virtual bool set_time(const TimeStep &time)
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)=0
std::string format(CStringRef format_str, ArgList args)
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Basic time management class.
static std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > function_factory(const Input::AbstractRecord &rec, unsigned int n_comp=0)
static string field_value_shape()
FieldAlgorithmBase(unsigned int n_comp=0)
Value value_
Last value, prevents passing large values (vectors) by value.
static Input::Type::Abstract & get_input_type()
virtual void set_mesh(const Mesh *mesh, bool boundary_domain)
static std::string template_name()
Representation of one time step.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
unsigned int n_comp() const
virtual void init_from_input(const Input::Record &rec)