33 #ifndef __H__UG_grid_function_coordinate_util
34 #define __H__UG_grid_function_coordinate_util
48 template <
typename TGr
idFunction>
59 || spGridFct->local_finite_element_id(fct).order() != 1,
60 "Fast P1 interpolation may only be used for Lagrange P1 functions.");
63 typedef typename TGridFunction::domain_type domain_type;
66 typename domain_type::position_accessor_type& aaPos
67 = spGridFct->domain()->position_accessor();
69 std::vector<DoFIndex> ind;
70 typename TGridFunction::template dim_traits<0>::const_iterator iterEnd, iter;
72 for(
size_t i = 0; i < ssGrp.
size(); ++i)
75 const int si = ssGrp[i];
77 if(!spGridFct->is_def_in_subset(fct, si))
continue;
79 iterEnd = spGridFct->template end<Vertex>(si);
80 iter = spGridFct->template begin<Vertex>(si);
81 for(; iter != iterEnd; ++iter)
87 spGridFct->dof_indices(vrt, fct, ind);
90 for(
size_t i = 0; i < ind.size(); ++i)
93 aaPos[vrt][coordInd] +=
DoFRef(*spGridFct, ind[i]) * timestep;
99 template <
typename TGr
idFunction>
109 template <
typename TGr
idFunction>
117 const size_t fct = spGridFct->fct_id_by_name(cmp);
120 if(fct > spGridFct->num_fct())
121 UG_THROW(
"Interpolate: Name of component '"<<cmp<<
"' not found.");
123 const bool bAllowManyfoldInterpolation =
127 SubsetGroup ssGrp(spGridFct->domain()->subset_handler());
130 if(!bAllowManyfoldInterpolation)
@ LAGRANGE
Definition: local_finite_element_id.h:104
Group of subsets.
Definition: subset_group.h:51
size_t size() const
number of subsets in this group
Definition: subset_group.h:122
void add_all()
select all subsets of underlying subset handler
Definition: subset_group.cpp:133
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
#define UG_THROW(msg)
Definition: error.h:57
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
double number
Definition: types.h:124
void AddFunctionValuesToGridCoordinatesP1(SmartPtr< TGridFunction > spGridFct, size_t fct, size_t coordInd, const SubsetGroup &ssGrp, number timestep)
Definition: grid_function_coordinate_util.h:49
number & DoFRef(TMatrix &mat, const DoFIndex &iInd, const DoFIndex &jInd)
Definition: multi_index.h:276
void RemoveLowerDimSubsets(SubsetGroup &subsetGroup)
Definition: subset_group.cpp:315