18 #ifndef GENERIC_FIELD_IMPL_HH_
19 #define GENERIC_FIELD_IMPL_HH_
38 template <
int spacedim>
41 region_id.
name(
"region_id");
45 RegionSet all_regions=mesh.region_db().get_region_set(
"ALL");
46 for(
Region reg : all_regions) {
47 auto field_algo=std::make_shared<FieldConstant<spacedim, DoubleScalar>>();
48 field_algo->set_value(reg.id());
57 template <
int spacedim>
60 std::shared_ptr<DOFHandlerMultiDim> dh = std::make_shared<DOFHandlerMultiDim>(mesh);
61 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>( &mesh, fe);
62 dh->distribute_dofs(ds);
64 auto field_subdomain_data = mesh.get_part()->subdomain_id_field_data();
65 unsigned int data_size = field_subdomain_data->size();
69 for (
auto cell : dh->own_range()) {
70 data_vec.
set( cell.get_loc_dof_indices()(0), (*field_subdomain_data)[i_ele] );
73 std::shared_ptr< FieldFE<spacedim, DoubleScalar> > field_ptr = std::make_shared< FieldFE<spacedim, DoubleScalar> >();
74 field_ptr->set_fe_data(dh, data_vec);
77 subdomain.
name(
"subdomain");
90 template <
int spacedim>
93 std::shared_ptr<DOFHandlerMultiDim> dh = std::make_shared<DOFHandlerMultiDim>(mesh);
94 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>( &mesh, fe);
95 dh->distribute_dofs(ds);
100 for (
auto cell : dh->own_range()) {
101 data_vec.
set( cell.get_loc_dof_indices()(0), cell.elm().measure() );
104 std::shared_ptr< FieldFE<spacedim, DoubleScalar> > field_ptr = std::make_shared< FieldFE<spacedim, DoubleScalar> >();
105 field_ptr->set_fe_data(dh, data_vec);
108 measure.
name(
"element_measure");
121 template <
int spacedim>
124 std::shared_ptr<DOFHandlerMultiDim> dh = std::make_shared<DOFHandlerMultiDim>(mesh);
125 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>( &mesh, fe);
126 dh->distribute_dofs(ds);
130 unsigned int i_ele=0;
131 for (
auto cell : dh->own_range()) {
133 for (
auto side : cell.side_range())
134 h = max(h, side.diameter());
135 data_vec.
set( cell.get_loc_dof_indices()(0), h );
138 std::shared_ptr< FieldFE<spacedim, DoubleScalar> > field_ptr = std::make_shared< FieldFE<spacedim, DoubleScalar> >();
139 field_ptr->set_fe_data(dh, data_vec);
142 diam.
name(
"element_diameter");