7#ifndef elementFormVector_hh
8#define elementFormVector_hh
15#include "function/vector.hh"
19#define ElmFormVectorBaseConstr_D 0
24 template<
typename F,
typename G>
25 class ElementFunction;
39 template<
typename F,
class G,
class H,
class I>
54 std::unique_ptr<const ElementFunction<I,G> >
f_;
56 mutable const Element<G> *lastElm_, *lastElmOur_;
61 template<
typename J,
typename P>
63 const Real t = 0.0)
const;
66 std::unordered_map<uint, const Element<G>*> elementPointer_;
74 template<
class F,
class G,
class H,
class I>
77 : spc_(spc), v_(v), f_(f.clone()), lastElm_(0), lastElmOur_(0), coeff_(0)
79 DEBUGL(ElmFormVectorBaseConstr_D,
"start");
83 uint key = getKey_(elm);
84 elementPointer_.insert
86 DEBUGL(ElmFormVectorBaseConstr_D,
87 "Inserted key = " << key <<
" -> elm = " << elm);
89 DEBUGL(ElmFormVectorBaseConstr_D,
"done.");
92 template<
class F,
class G,
class H,
class I>
102 template<
class F,
class G,
class H,
class I>
103 void ElementFormulaVectorBase<F,G,H,I>::getElement_
104 (
const Element<G>& elm,
const Element<G>*&
elmOur)
const {
105 uint key = getKey_(elm);
106 typename std::unordered_map<uint, const Element<G>*>::const_iterator i =
107 elementPointer_.find(key);
108 if (i == elementPointer_.end())
109 throw(ElementNotInDomainOfFormula(elm));
111 lastElmOur_ =
elmOur = i->second;
115 template<
class F,
class G,
class H,
class I>
116 template<
typename J,
typename P>
124 elmOur->T().extract(v_, coeff_);
125 DEBUGL(0,
"coeff_ = " << coeff_);
126 (*f_)(*
elmOur, coeff_, val, p, t);
127 DEBUGL(0,
"val = " << val);
142 template<
uint dim,
class F =
Real,
class G = F,
154 const Real p,
const Real t = 0.0)
const;
164 virtual std::ostream&
info(std::ostream&
os)
const;
167 template<u
int dim,
class F,
class G,
class H>
173 "not matching number of vector components of element function");
176 template<u
int dim,
class F,
class G,
class H>
181 this->compute_(elm, val, p, t);
189 template<u
int dim,
class F,
class G,
class H>
190 Point<G,dim> ElementFormulaVector<dim,F,G,H>::operator()
194 this->compute_(elm, val, p, t);
203 template<u
int dim,
class F,
class G,
class H>
204 Point<G,dim> ElementFormulaVector<dim,F,G,H>::operator()
208 this->compute_(elm, val, p, t);
216 template<u
int dim,
class F,
class G,
class H>
229 template<
class F,
class G,
class H>
241 const Real t = 0.0)
const;
243 const Real t = 0.0)
const;
245 const Real t = 0.0)
const;
251 virtual std::ostream&
info(std::ostream&
os)
const;
254 template<
class F,
class G,
class H>
259 "only scalar element functions");
262 template<
class F,
class G,
class H>
266 this->compute_(elm,
res, p, t);
270 template<
class F,
class G,
class H>
271 G ElementFormulaVector<1,F,G,H>::operator()
274 this->compute_(elm,
res, p, t);
279 template<
class F,
class G,
class H>
280 G ElementFormulaVector<1,F,G,H>::operator()
283 this->compute_(elm,
res, p, t);
287 template<
class F,
class G,
class H>
290 return os <<
"ElementFormulaVector<1>(" << *this->f_ <<
", " << this->v_
uint size() const
Returns the requested size of the array.
virtual Connector & connector() const =0
Returns the connector.
const Key & key() const
Returns the key of the connector.
uint key() const
Returns the key.
virtual Scanner * scan() const =0
Returns a scanner to iterate over the elements of the space.
#define conceptsAssert(cond, exc)
#define DEBUGL(doit, msg)
#define conceptsAssert3(cond, exc, msg)
std::string typeOf(const T &t)
void memorycpy(F *dest, const G *src, size_t n)
Copies n entries from src to dest (faster than std::memcpy)
Set< F > makeSet(uint n, const F &first,...)