47 namespace Electromagnetism{
50 template <
typename TGr
idFunc,
typename TElem>
63 typedef typename TGridFunc::domain_type domain_type;
72 for (
size_t i = 0; i < (size_t) ref_elem_type::numSides; i++)
88 = pGF->domain()->position_accessor();
90 for (
size_t co = 0; co < (size_t) ref_elem_type::numCorners; co++)
91 corners[co] = aaPos [pElem->vertex (co)];
94 std::vector<DoFIndex> ind;
95 if (pGF->dof_indices (pElem, fct, ind) != (size_t) ref_elem_type::numEdges)
96 UG_THROW (
"Grid function type mismatch.");
97 number dofValues [ref_elem_type::numEdges];
98 for (
size_t dof = 0; dof < (size_t) ref_elem_type::numEdges; dof++)
99 dofValues[dof] =
DoFRef (*pGF, ind[dof]);
107 for (co = 0; co < pSide->num_vertices (); co++)
109 int elem_co = rRefElem.id (
dim-1, i, 0, co);
110 UG_ASSERT (elem_co >= 0,
"Index mismatch.");
111 loc_center += rRefElem.corner (elem_co);
118 (pGF->domain().get (), pElem, corners, dofValues, &loc_center, 1, &val);
122 SideNormal<ref_elem_type, dim> (
normal, i, corners);
146 for (
size_t i = 0; i < volSSG.
size (); i++)
150 t_elem_iterator elem_iter = pGF->template begin<TElem> (si);
151 t_elem_iterator end_iter = pGF->template end<TElem> (si);
152 for (; elem_iter != end_iter; ++elem_iter)
161 template <
typename TGr
idFunc>
174 UG_THROW (
"ComputeFlux: No flux computations in 1d.");
179 template <
typename TGr
idFunc>
211 template <
typename TGr
idFunc>
220 typedef typename TGridFunc::domain_type domain_type;
225 UG_THROW (
"ComputeFlux: Not a Nedelec-element-based grid function specified.");
228 boost::mpl::for_each<ElemList>
234 template <
typename TGr
idFunc>
238 const char * fct_names,
239 const char * vol_subsets,
240 const char * face_subsets
246 fctGrp = spGF->fct_grp_by_name (fct_names);
249 "' not all contained in the edge approximation space.");
250 if (fctGrp.
size () != 1)
251 UG_THROW (
"ComputeFlux: Only one function component per call supported");
254 std::vector<std::string> vssNames;
257 for (
size_t i = 0; i < vssNames.size(); i++)
260 volSSG.
add (vssNames);
263 for (
size_t i = 0; i < vssNames.size(); i++)
266 faceSSG.
add (vssNames);
269 UG_LOG (
"--> Flux: " << flux <<
'\n');
static number compute_flux(TGridFunc *pGF, size_t fct, SubsetGroup &volSSG, SubsetGroup &faceSSG)
Computation of the flux through the sides of all elements of one type.
Definition: nedelec_aux_cmd_impl.h:167
Helper class for computation of the flux in elements. (Helper for ComputeFlux.)
Definition: nedelec_aux_cmd_impl.h:52
static number compute_elem_flux(TGridFunc *pGF, size_t fct, TElem *pElem, SubsetGroup &faceSSG)
Computation of the flux through sides of an element.
Definition: nedelec_aux_cmd_impl.h:56
static number compute_flux(TGridFunc *pGF, size_t fct, SubsetGroup &volSSG, SubsetGroup &faceSSG)
Computation of the flux through the sides of all elements of one type.
Definition: nedelec_aux_cmd_impl.h:134
Helper class for the loop over all the elements in the computation of the flux. (Helper for ComputeFl...
Definition: nedelec_aux_cmd_impl.h:181
ComputeFluxHelper(TGridFunc *pGF, size_t fct, SubsetGroup &volSSG, SubsetGroup &faceSSG, number &flux)
class constructor
Definition: nedelec_aux_cmd_impl.h:192
number & m_flux
Definition: nedelec_aux_cmd_impl.h:186
TGridFunc * m_pGF
Definition: nedelec_aux_cmd_impl.h:182
void operator()(TElem &)
Definition: nedelec_aux_cmd_impl.h:204
SubsetGroup & m_volSSG
Definition: nedelec_aux_cmd_impl.h:184
size_t m_fct
Definition: nedelec_aux_cmd_impl.h:183
SubsetGroup & m_faceSSG
Definition: nedelec_aux_cmd_impl.h:185
static void value(const TDomain *domain, GridObject *elem, const position_type corners[], const number dofs[], const MathVector< refDim > local[], const size_t n_pnt, MathVector< WDim > values[])
computes the values at given points
Definition: nedelec_local_ass.h:411
Edge::side * get_side(Edge *obj, size_t side)
int get_subset_index(const char *name) const
bool contains(const char *name) const
void add(const char *name)
void set_subset_handler(ConstSmartPtr< ISubsetHandler > sh)
Grid::VertexAttachmentAccessor< position_attachment_type > position_accessor_type
MathVector< dim > position_type
vector< string > TokenizeString(const char *str, const char delimiter=',')
void RemoveWhitespaceFromString(std::string &string)
#define UG_ASSERT(expr, msg)
#define UG_CATCH_THROW(msg)
vector_t::value_type VecDot(const vector_t &v1, const vector_t &v2)
number ComputeFlux(TGridFunc *pGF, size_t fct, SubsetGroup &volSSG, SubsetGroup &faceSSG)
returns the flux through a given surface
Definition: nedelec_aux_cmd_impl.h:213
const number & DoFRef(const TMatrix &mat, const DoFIndex &iInd, const DoFIndex &jInd)
geometry_traits< TElem >::const_iterator const_iterator