18 #ifndef GENERIC_FIELD_IMPL_HH_
19 #define GENERIC_FIELD_IMPL_HH_
37 template <
int spacedim>
40 region_id.
name(
"region_id");
44 RegionSet all_regions=mesh.region_db().get_region_set(
"ALL");
45 for(
Region reg : all_regions) {
46 auto field_algo=std::make_shared<FieldConstant<spacedim, DoubleScalar>>();
47 field_algo->set_value(reg.id());
56 template <
int spacedim>
59 std::shared_ptr<DOFHandlerMultiDim> dh = std::make_shared<DOFHandlerMultiDim>(mesh);
60 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>( &mesh, fe);
61 dh->distribute_dofs(ds);
63 auto field_subdomain_data = mesh.get_part()->subdomain_id_field_data();
64 unsigned int data_size = field_subdomain_data->size();
68 for (
auto cell : dh->own_range()) {
69 data_vec.
set( cell.get_loc_dof_indices()(0), (*field_subdomain_data)[i_ele] );
72 std::shared_ptr< FieldFE<spacedim, DoubleScalar> > field_ptr = std::make_shared< FieldFE<spacedim, DoubleScalar> >();
73 field_ptr->set_fe_data(dh, data_vec);
76 subdomain.
name(
"subdomain");
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
FieldCommon & name(const string &name)
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
Class template representing a field with values dependent on: point, element, and region.
void set(FieldBasePtr field, double time, std::vector< std::string > region_set_names={"ALL"})
void set_mesh(const Mesh &mesh) override
static auto region_id(Mesh &mesh) -> IndexField
static auto subdomain(Mesh &mesh) -> IndexField
static UnitSI & dimensionless()
Returns dimensionless unit.
void set(unsigned int pos, double val)
Set value on given position.
Declaration of class which provides the finite element for every mesh cell.
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
Definitions of basic Lagrangean finite elements with polynomial shape functions.
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell.