38 template <
int spacedim, class Value>
39 const
Input::Type::Record &
FieldFE<spacedim, Value>::get_input_type()
45 "GMSH mesh with data. Can be different from actual computational mesh.")
47 "The values of the Field are read from the ```$ElementData``` section with field name given by this key.")
51 template <
int spacedim,
class Value>
53 Input::register_class< FieldFE<spacedim, Value>,
unsigned int >(
"FieldFE") +
58 template <
int spacedim,
class Value>
67 template <
int spacedim,
class Value>
77 unsigned int ndofs = max(
dh_->fe<1>()->n_dofs(), max(
dh_->fe<2>()->n_dofs(),
dh_->fe<3>()->n_dofs()));
84 init_data.
ndofs = ndofs;
98 template <
int spacedim,
class Value>
109 ASSERT(
false).error(
"Invalid element dimension!");
120 template <
int spacedim,
class Value>
124 ASSERT_EQ( point_list.size(), value_list.size() ).error();
137 ASSERT(
false).error(
"Invalid element dimension!");
143 template <
int spacedim,
class Value>
156 template <
int spacedim,
class Value>
160 ASSERT(
field_name_ !=
"").error(
"Uninitialized FieldFE, did you call init_from_input()?\n");
167 template <
int spacedim,
class Value>
174 dh_ = std::make_shared<DOFHandlerMultiDim>(
const_cast<Mesh &
>(*mesh) );
175 dh_->distribute_dofs(*
fe1_, *fe2_, *fe3_);
176 unsigned int ndofs = max(dh_->fe<1>()->
n_dofs(), max(dh_->fe<2>()->
n_dofs(), dh_->fe<3>()->n_dofs()));
180 unsigned int data_size = dh_->n_global_dofs();
188 init_data.
ndofs = ndofs;
199 template <
int spacedim,
class Value>
203 ASSERT(
field_name_ !=
"").error(
"Uninitialized FieldFE, did you call init_from_input()?\n");
210 search_header.
actual =
false;
213 search_header.
n_entities = source_mesh->element.size();
214 search_header.
time = time.
end();
216 bool boundary_domain_ =
false;
218 source_mesh->elements_id_maps(boundary_domain_), this->
component_idx_);
221 return search_header.actual;
227 template <
int spacedim,
class Value>
236 searched_elements.clear();
237 source_mesh->get_bih_tree().find_point(ele->centre(), searched_elements);
238 std::fill(sum_val.begin(), sum_val.end(), 0.0);
239 std::fill(elem_count.begin(), elem_count.end(), 0);
243 switch (elm->dim()) {
254 ASSERT(
false).error(
"Invalid element dimension!");
258 sum_val[elm->dim()] += (*data_vec)[*
it];
259 ++elem_count[elm->dim()];
262 unsigned int dim = ele->dim();
263 double elem_value = 0.0;
265 if (elem_count[dim] > 0) {
266 elem_value = sum_val[dim] / elem_count[dim];
280 template <
int spacedim,
class Value>
virtual ~FieldFE()
Destructor.
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
std::shared_ptr< std::vector< T > > ComponentDataPtr
void interpolate(ElementDataCache< double >::ComponentDataPtr data_vec)
Interpolate data over all elements of target mesh.
VectorSeqDouble * data_vec_
Store data of Field.
unsigned int component_idx_
Specify if the field is part of a MultiField and which component it is.
void initialize(FEValueInitData init_data, MappingP1< elemdim, 3 > *map=nullptr)
Initialize data members.
#define FOR_ELEMENTS(_mesh_, __i)
std::string field_name_
field name read from input
FEValueHandler< 2, spacedim, Value > value_handler2_
Value handler that allows get value of 2D elements.
FilePath reader_file_
mesh reader file
#define INSTANCE_ALL(field)
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
void set_mesh(const Mesh *mesh, bool boundary_domain) override
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
FEValueHandler< 3, spacedim, Value > value_handler3_
Value handler that allows get value of 3D elements.
bool set_time(const TimeStep &time) override
Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Returns one value in one given point.
Value::return_type r_value_
unsigned int size()
Getter for shared pointer of output data.
unsigned int * dof_indices
Array of indexes to data_vec_, used for get/set values.
constexpr bool match(Mask mask) const
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
Discontinuous Lagrangean finite element on dim dimensional simplex.
std::shared_ptr< DOFHandlerMultiDim > dh_
DOF handler object.
FiniteElement< 2, 3 > * fe2_
Same as previous, but represents 2D element.
void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Returns std::vector of scalar values in several points at once.
VectorSeqDouble * data_vec
Store data of Field.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
void resize(unsigned int size)
Create shared pointer and PETSC vector with given size.
static std::shared_ptr< GmshMeshReader > get_reader(const FilePath &file_path)
static std::shared_ptr< Mesh > get_mesh(const FilePath &file_path)
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
unsigned int ndofs
number of dofs
Space< spacedim >::Point Point
std::shared_ptr< DOFHandlerMultiDim > dh
DOF handler object.
void set_fe_data(std::shared_ptr< DOFHandlerMultiDim > dh, MappingP1< 1, 3 > *map1, MappingP1< 2, 3 > *map2, MappingP1< 3, 3 > *map3, VectorSeqDouble *data)
FEValueHandler< 1, spacedim, Value > value_handler1_
Value handler that allows get value of 1D elements.
Dedicated class for storing path to input and output files.
Value value_
Last value, prevents passing large values (vectors) by value.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
FieldFE(unsigned int n_comp=0)
bool contains_point(arma::vec point, Element &elm)
Test if element contains given point.
const unsigned int n_dofs() const
Returns the number of degrees of freedom needed by the finite element.
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
static constexpr Mask equation_input
The field is data parameter of the owning equation. (default on)
FiniteElement< 1, 3 > * fe1_
unsigned int n_comp
number of components
FieldFlag::Flags flags_
Field flags.
Initialization structure of FEValueHandler class.
FiniteElement< 3, 3 > * fe3_
Same as previous, but represents 3D element.
Representation of one time step..
void make_dof_handler(const Mesh *mesh)
Create DofHandler object.
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
static constexpr Mask declare_input
The field can be set from input. The key in input field descriptor is declared. (default on) ...
unsigned int n_comp() const
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.