18 #ifndef FIELD_ELEMENTWISE_IMPL_HH_ 19 #define FIELD_ELEMENTWISE_IMPL_HH_ 35 template <
int spacedim, class Value>
41 "Input file with ASCII GMSH file format.")
43 "The values of the Field are read from the ```$ElementData``` section with field name given by this key.")
48 template <
int spacedim,
class Value>
50 Input::register_class< FieldElementwise<spacedim, Value>,
unsigned int >(
"FieldElementwise") +
55 template <
int spacedim,
class Value>
58 internal_raw_data(true), mesh_(NULL)
66 template <
int spacedim,
class Value>
68 unsigned int n_components)
79 template <
int spacedim,
class Value>
92 template <
int spacedim,
class Value>
95 OLD_ASSERT( this->
value_.n_cols() == ref.n_cols(),
"Size of variable vectors do not match.\n" );
100 for(
unsigned int row=0; row < ref.n_rows(); row++)
101 for(
unsigned int col=0; col < ref.n_cols(); col++, vec_pos++)
102 vec[vec_pos] = ref(row,col);
107 template <
int spacedim,
class Value>
117 search_header.
actual=
false;
126 return search_header.actual;
131 template <
int spacedim,
class Value>
134 OLD_ASSERT(
mesh_ ==
nullptr ||
mesh_ == mesh,
"Trying to change mesh of the FieldElementwise.");
146 data_ = std::make_shared<std::vector<typename Value::element_type>>();
157 template <
int spacedim,
class Value>
166 return Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
174 template <
int spacedim,
class Value>
181 if (boost::is_floating_point< typename Value::element_type>::value) {
185 typename Value::return_type
const &ref = Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
186 for(
unsigned int i=0; i< value_list.size(); i++) {
188 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
189 i, Value(value_list[i]).n_rows(),this->
value_.n_rows());
194 xprintf(
UsrErr,
"FieldElementwise is not implemented for discrete return types.\n");
200 template <
int spacedim,
class Value>
std::shared_ptr< std::vector< typename Value::element_type > > data_
Raw buffer of n_entities rows each containing Value::size() doubles.
virtual ~FieldElementwise()
virtual void init_from_input(const Input::Record &rec)
unsigned int component_idx_
Specify if the field is part of a MultiField and which component it is.
bool is_boundary() const
We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular...
void set_data_row(unsigned int boundary_idx, typename Value::return_type &value)
Value::return_type r_value_
unsigned int size() const
Returns size of the container. This is independent of the allocated space.
unsigned int n_elements() const
bool is_elemental() const
bool set_time(const TimeStep &time) override
vector< int > const & elements_id_maps(bool boundary_domain) const
FieldElementwise(unsigned int n_comp=0)
ElementVector bc_elements
Space< spacedim >::Point Point
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Dedicated class for storing path to input and output files.
unsigned int n_components_
Size of Value.
Value value_
Last value, prevents passing large values (vectors) by value.
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
unsigned int n_entities_
Number of rows in data_ buffer.
std::shared_ptr< GmshMeshReader > get_reader(const FilePath &file_path)
#define OLD_ASSERT_EQUAL(a, b)
virtual void set_mesh(const Mesh *mesh, bool boundary_domain)
static ReaderInstances * instance()
Returns singleton instance.
Representation of one time step..
#define FLOW123D_FORCE_LINK_IN_CHILD(x)