ug4
user_data.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__USER_DATA__USER_DATA__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__USER_DATA__USER_DATA__
35 
36 #include <vector>
37 #include <cstring>
38 
39 #include "common/types.h"
43 
44 namespace ug{
45 
47 // UserData Info
49 
51 class UserDataInfo {
52  public:
54  virtual int get_dim() const = 0;
55 
57  virtual std::string type() const = 0;
58 
60  virtual bool continuous() const = 0;
61 
63  virtual ~UserDataInfo() {}
64 
65  public:
67  virtual bool requires_grid_fct() const = 0;
68 
72  }
73 
75  const FunctionGroup& function_group() const {return m_fctGrp;}
76 
78  const FunctionIndexMapping& map() const{return m_map;}
79 
81  size_t num_fct() const {return m_map.num_fct();}
82 
84 
87  void set_obj_name(const char * name)
88  {
89  if (name == NULL) {m_objName = SPNULL; return;}
90  if (m_objName.valid ()) // we assume that the name is assigned once; otherwise we warn
91  UG_LOG ("Warning: Replacing existing UserData object name '" << m_objName.get() << "' with '" << name << "'.\n");
92  const size_t name_len = strnlen (name, 128);
93  SmartPtr<char> new_name (new char [name_len+1]);
94  memcpy (new_name.get(), name, name_len); (new_name.get()) [name_len] = '\0';
95  m_objName = new_name;
96  }
97 
99 
102  const char * obj_name () {return m_objName.get ();}
103 
104  protected:
107 
110 
113 };
114 
116 // UserData
118 
119 // Traits
120 template <typename TData>
121 struct user_data_traits{static std::string name() {return "(unknown)";}};
122 template <>
123 struct user_data_traits<number>{static std::string name() {return "Number";}};
124 template <std::size_t dim>
125 struct user_data_traits< MathVector<dim> >{static std::string name() {return "Vector";}};
126 template <std::size_t dim>
127 struct user_data_traits< MathMatrix<dim,dim> >{static std::string name() {return "Matrix";}};
128 template <std::size_t dim>
129 struct user_data_traits< MathTensor<4,dim> >{static std::string name() {return "Tensor4";}};
130 
132 
141 template <typename TData, int dim, typename TRet = void>
142 class UserData : virtual public UserDataInfo
143 {
144  public:
145  typedef TData data_type;
146  typedef TRet return_type;
147 
149  int get_dim() const {return dim;}
150 
152  std::string type() const {return user_data_traits<TData>::name();}
153 
155  virtual bool continuous() const = 0;
156 
158  virtual bool requires_grid_fct() const = 0;
159 
160  public:
162  virtual TRet operator() (TData& value,
163  const MathVector<dim>& globIP,
164  number time, int si) const = 0;
165 
167  virtual void operator()(TData vValue[],
168  const MathVector<dim> vGlobIP[],
169  number time, int si, const size_t nip) const = 0;
170 
172  virtual void operator() (TData& value,
173  const MathVector<dim>& globIP,
174  number time, int si,
175  Vertex* vrt) const
176  {
177  // The standard version uses only the coordinates. But it can be redefined.
178  operator()(value, globIP, time, si);
179  }
180 
183  TRet operator() (TData& value,
184  const MathVector<dim>& globIP,
185  number time, int si,
186  GridObject* elem,
187  const MathVector<dim> vCornerCoords[],
188  const MathVector<1>& locIP,
189  LocalVector* u) const {
190  operator()(&value, &globIP, time, si, elem, vCornerCoords, &locIP, 1, u);
191  }
192 
193  TRet operator() (TData& value,
194  const MathVector<dim>& globIP,
195  number time, int si,
196  GridObject* elem,
197  const MathVector<dim> vCornerCoords[],
198  const MathVector<2>& locIP,
199  LocalVector* u) const {
200  operator()(&value, &globIP, time, si, elem, vCornerCoords, &locIP, 1, u);
201  }
202 
203  TRet operator() (TData& value,
204  const MathVector<dim>& globIP,
205  number time, int si,
206  GridObject* elem,
207  const MathVector<dim> vCornerCoords[],
208  const MathVector<3>& locIP,
209  LocalVector* u) const {
210  operator()(&value, &globIP, time, si, elem, vCornerCoords, &locIP, 1, u);
211  }
213 
216  virtual void operator()(TData vValue[],
217  const MathVector<dim> vGlobIP[],
218  number time, int si,
219  GridObject* elem,
220  const MathVector<dim> vCornerCoords[],
221  const MathVector<1> vLocIP[],
222  const size_t nip,
223  LocalVector* u,
224  const MathMatrix<1, dim>* vJT = NULL) const = 0;
225 
226  virtual void operator()(TData vValue[],
227  const MathVector<dim> vGlobIP[],
228  number time, int si,
229  GridObject* elem,
230  const MathVector<dim> vCornerCoords[],
231  const MathVector<2> vLocIP[],
232  const size_t nip,
233  LocalVector* u,
234  const MathMatrix<2, dim>* vJT = NULL) const = 0;
235 
236  virtual void operator()(TData vValue[],
237  const MathVector<dim> vGlobIP[],
238  number time, int si,
239  GridObject* elem,
240  const MathVector<dim> vCornerCoords[],
241  const MathVector<3> vLocIP[],
242  const size_t nip,
243  LocalVector* u,
244  const MathMatrix<3, dim>* vJT = NULL) const = 0;
246 };
248 // UserData Interface
250 
252 
258 template <int dim>
259 class ICplUserData : virtual public UserDataInfo
260 {
261  public:
263  ICplUserData();
264 
266  void clear();
267 
268  public:
270  void set_subset(int si) {m_si = si;}
271 
273  int subset() const {return m_si;}
274 
276  void set_times(const std::vector<number>& vTime) {m_vTime = vTime;}
277 
279  void set_time_point(size_t timePoint) {m_timePoint = timePoint;}
280 
282  size_t time_point() {return m_timePoint;}
283 
285  number time() const {return m_vTime[m_timePoint];}
286 
287  public:
289  virtual bool constant() const {return false;}
290 
292  virtual size_t num_needed_data() const {return 0;}
293 
295  virtual SmartPtr<ICplUserData> needed_data(size_t i) {return SPNULL;}
296 
298  virtual void compute(LocalVector* u,
299  GridObject* elem,
300  const MathVector<dim> vCornerCoords[],
301  bool bDeriv = false) = 0;
302 
305  GridObject* elem,
306  const MathVector<dim> vCornerCoords[],
307  bool bDeriv = false) = 0;
308 
310  virtual void check_setup() const {}
311 
313  virtual ~ICplUserData() {};
314 
315  public:
317  virtual bool zero_derivative() const {return true;}
318 
320  virtual void update_dof_sizes(const LocalIndices& ind) {}
321 
322  public:
324  size_t num_series() const {return m_vNumIP.size();}
325 
327  size_t num_ip(size_t s) const {UG_ASSERT(s < num_series(), "Invalid series"); return m_vNumIP[s];}
328 
330 
338  template <int ldim>
339  size_t register_local_ip_series(const MathVector<ldim>* vPos,
340  const size_t numIP,
341  const int timePointSpec,
342  bool bMayChange = true);
343 
345  template <int ldim>
347  const size_t numIP,
348  bool bMayChange = true)
349  {
350  return this->template register_local_ip_series<ldim> (vPos, numIP, -1, bMayChange);
351  };
352 
354 
359  template <int ldim>
360  void set_local_ips(const size_t seriesId, const MathVector<ldim>* vPos,
361  const size_t numIP);
362 
364 
369  void set_time_point(const size_t seriesId, const int timePointSpec);
370 
372  int dim_local_ips() const {return m_locPosDim;}
373 
375  template <int ldim>
376  const MathVector<ldim>* local_ips(size_t s) const;
377 
379  template <int ldim>
380  const MathVector<ldim>& local_ip(size_t s, size_t ip) const;
381 
383  inline int time_point_specification(size_t s) const;
384 
386  inline size_t time_point(size_t s) const;
387 
389  number time(size_t s) const {return m_vTime[time_point(s)];}
390 
392  inline bool at_current_time(size_t s) const;
393 
395  void set_global_ips(size_t s, const MathVector<dim>* vPos, size_t numIP);
396 
398  const MathVector<dim>* ips(size_t s) const {check_s(s); return m_vvGlobPos[s];}
399 
401  const MathVector<dim>& ip(size_t s, size_t ip) const{check_s_ip(s,ip); return m_vvGlobPos[s][ip];}
402 
403  protected:
405 
417  virtual void local_ip_series_added(const size_t seriesID){m_vvGlobPos.resize(seriesID+1);}
418 
420  virtual void local_ips_changed(const size_t seriesID, const size_t newNumIP) = 0;
421 
423  virtual void local_ip_series_to_be_cleared() {m_vvGlobPos.clear();}
424 
426 
431  virtual void global_ips_changed(const size_t seriesID, const MathVector<dim>* vPos, const size_t numIP) {};
432 
434  inline void check_s(size_t s) const;
435 
437  inline void check_s_ip(size_t s, size_t ip) const;
438 
439  protected:
441  std::vector<const MathVector<1>*>& get_local_ips(Int2Type<1>) {return m_pvLocIP1d;}
442  std::vector<const MathVector<2>*>& get_local_ips(Int2Type<2>) {return m_pvLocIP2d;}
443  std::vector<const MathVector<3>*>& get_local_ips(Int2Type<3>) {return m_pvLocIP3d;}
444  const std::vector<const MathVector<1>*>& get_local_ips(Int2Type<1>) const {return m_pvLocIP1d;}
445  const std::vector<const MathVector<2>*>& get_local_ips(Int2Type<2>) const {return m_pvLocIP2d;}
446  const std::vector<const MathVector<3>*>& get_local_ips(Int2Type<3>) const {return m_pvLocIP3d;}
447 
448  protected:
450  std::vector<bool> m_vMayChange;
451 
453  std::vector<size_t> m_vNumIP;
454 
457 
459  std::vector<const MathVector<1>*> m_pvLocIP1d;
460  std::vector<const MathVector<2>*> m_pvLocIP2d;
461  std::vector<const MathVector<3>*> m_pvLocIP3d;
462 
464  std::vector<int> m_vTimePoint;
465 
467  std::vector<const MathVector<dim>*> m_vvGlobPos;
468 
470  std::vector<number> m_vTime;
471 
473  size_t m_timePoint;
474 
477 
479  int m_si;
480 };
481 
483 // UserData
485 
486 // predeclaration
487 template <typename TData, int dim> class DataImport;
488 
490 
499 template <typename TData, int dim, typename TRet = void>
500 class CplUserData : public ICplUserData<dim>, public UserData<TData,dim,TRet>
501 {
502  public:
505 
509 
510  public:
512  const TData& value(size_t s, size_t ip) const
513  {check_series_ip(s,ip); return m_vvValue[s][ip];}
514 
516  const TData* values(size_t s) const
517  {
518  check_series(s);
519  if(m_vvValue[s].empty())
520  return NULL;
521  return &(m_vvValue[s][0]);
522  }
523 
525  TData& value(size_t s, size_t ip)
526  {check_series_ip(s,ip);return m_vvValue[s][ip];}
527 
529  TData* values(size_t s)
530  {
531  check_series(s);
532  if(m_vvValue[s].empty())
533  return NULL;
534  return &(m_vvValue[s][0]);
535  }
536 
538  bool defined(size_t s, size_t ip) const
539  {check_series_ip(s,ip); return m_vvBoolFlag[s][ip];}
540 
543 
546 
549 
550  protected:
552  inline void check_series(size_t s) const;
553 
555  inline void check_series_ip(size_t s, size_t ip) const;
556 
558  virtual void local_ip_series_added(const size_t seriesID);
559 
561  virtual void local_ip_series_to_be_cleared();
562 
564  virtual void local_ips_changed(const size_t seriesID, const size_t newNumIP);
565 
567  virtual void value_storage_changed(const size_t seriesID) {}
568 
570  void call_storage_callback() const;
571 
572  private:
574  std::vector<std::vector<TData> > m_vvValue;
575 
577  std::vector<std::vector<bool> > m_vvBoolFlag;
578 
580 // typedef void (DataImport<TData,dim>::*CallbackFct)();
581  typedef boost::function<void ()> CallbackFct;
582  std::vector<std::pair<DataImport<TData,dim>*, CallbackFct> > m_vCallback;
583 
584 };
585 
587 // Dependent UserData
589 
591 
595 template <typename TData, int dim>
596 class DependentUserData : public CplUserData<TData, dim>
597 {
598  public:
601 
602  // explicitly forward methods of ICplUserData
603  using base_type::num_series;
604  using base_type::num_ip;
605  using base_type::local_ips;
606 
607  public:
610 
613  DependentUserData(const char* symbFct) {set_functions(symbFct);}
614  DependentUserData(const std::string& symbFct) {set_functions(symbFct);}
615  DependentUserData(const std::vector<std::string>& symbFct) {set_functions(symbFct);}
617 
618  public:
620  size_t num_sh(size_t fct) const
621  {
622  UG_ASSERT(fct < m_vvNumDoFPerFct.size(), "Wrong index");
623  return m_vvNumDoFPerFct[fct];
624  }
625 
627  const TData& deriv(size_t s, size_t ip, size_t fct, size_t dof) const
628  {check_s_ip_fct_dof(s,ip,fct,dof);return m_vvvvDeriv[s][ip][fct][dof];}
629 
631  TData& deriv(size_t s, size_t ip, size_t fct, size_t dof)
632  {check_s_ip_fct_dof(s,ip,fct,dof);return m_vvvvDeriv[s][ip][fct][dof];}
633 
635  TData* deriv(size_t s, size_t ip, size_t fct)
636  {check_s_ip_fct(s,ip,fct);return &(m_vvvvDeriv[s][ip][fct][0]);}
637 
639  const TData* deriv(size_t s, size_t ip, size_t fct) const
640  {check_s_ip_fct(s,ip,fct);return &(m_vvvvDeriv[s][ip][fct][0]);}
641 
643  static void set_zero(std::vector<std::vector<TData> > vvvDeriv[], const size_t nip);
644 
645  public:
647  virtual bool zero_derivative() const {return false;}
648 
650  virtual bool requires_grid_fct() const {return true;}
651 
653  virtual void update_dof_sizes(const LocalIndices& ind);
654 
657 
660  void set_functions(const char* symbFct);
661  void set_functions(const std::string& symbFct);
662  void set_functions(const std::vector<std::string>& symbFct);
664 
665  protected:
667  void extract_fct_grp();
668 
669  protected:
671  std::vector<std::string> m_SymbFct;
672 
673  protected:
675  inline void check_s_ip(size_t s, size_t ip) const;
676 
678  inline void check_s_ip_fct(size_t s, size_t ip, size_t fct) const;
679 
681  inline void check_s_ip_fct_dof(size_t s, size_t ip, size_t fct, size_t dof) const;
682 
684  virtual void local_ip_series_added(const size_t seriesID);
685 
687  virtual void local_ips_changed(const size_t seriesID, const size_t newNumIP);
688 
690  virtual void local_ip_series_to_be_cleared();
691 
693  void resize_deriv_array();
694 
696  void resize_deriv_array(const size_t seriesID);
697 
698  protected:
700  std::vector<size_t> m_vvNumDoFPerFct;
701 
702  // Data (size: (0,...,num_series-1) x (0,...,num_ip-1) x (0,...,num_fct-1) x (0,...,num_sh(fct) )
704  std::vector<std::vector<std::vector<std::vector<TData> > > > m_vvvvDeriv;
705 };
706 
707 } // end namespace ug
708 
709 //include implementation
710 #include "user_data_impl.h"
711 
712 #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__USER_DATA__USER_DATA__ */
parameterString s
location name
Definition: checkpoint_util.lua:128
Definition: smart_pointer.h:296
T * get()
returns encapsulated pointer
Definition: smart_pointer.h:197
bool valid() const
returns true if the pointer is valid, false if not.
Definition: smart_pointer.h:206
Type based UserData.
Definition: user_data.h:501
void check_series(size_t s) const
checks in debug mode the correct index
Definition: user_data_impl.h:308
void register_storage_callback(DataImport< TData, dim > *obj, void(DataImport< TData, dim >::*func)())
register external callback, invoked when data storage changed
Definition: user_data_impl.h:273
const TData * values(size_t s) const
returns all values for a series
Definition: user_data.h:516
std::vector< std::vector< bool > > m_vvBoolFlag
bool flag at ip (size: (0,...num_series-1) x (0,...,num_ip-1))
Definition: user_data.h:577
TData & value(size_t s, size_t ip)
returns the value at ip
Definition: user_data.h:525
ICplUserData< dim > base_type
type of base class
Definition: user_data.h:504
std::vector< std::pair< DataImport< TData, dim > *, CallbackFct > > m_vCallback
Definition: user_data.h:582
void call_storage_callback() const
calls are registered external storage callbacks
Definition: user_data_impl.h:296
void check_series_ip(size_t s, size_t ip) const
checks in debug mode the correct index
Definition: user_data_impl.h:315
virtual void local_ip_series_added(const size_t seriesID)
resizes the data field, when local ip changed signaled
Definition: user_data_impl.h:323
std::vector< std::vector< TData > > m_vvValue
data at ip (size: (0,...num_series-1) x (0,...,num_ip-1))
Definition: user_data.h:574
virtual void local_ip_series_to_be_cleared()
free the data field memory and set series to zero
Definition: user_data_impl.h:349
bool defined(size_t s, size_t ip) const
returns flag, if data is evaluated (for conditional data)
Definition: user_data.h:538
void unregister_storage_callback(DataImport< TData, dim > *obj)
register all callbacks registered by class
Definition: user_data_impl.h:282
boost::function< void()> CallbackFct
registered callbacks
Definition: user_data.h:581
TData * values(size_t s)
returns all values for a series
Definition: user_data.h:529
size_t num_ip(size_t s) const
returns the number of integration points
Definition: user_data.h:327
virtual void value_storage_changed(const size_t seriesID)
callback, invoked when storage of data has changed for a series
Definition: user_data.h:567
~CplUserData()
destructor
Definition: user_data.h:542
size_t num_series() const
explicitly forward some functions
Definition: user_data.h:324
const TData & value(size_t s, size_t ip) const
returns the value at ip
Definition: user_data.h:512
virtual void local_ips_changed(const size_t seriesID, const size_t newNumIP)
implement callback, called when local IPs changed
Definition: user_data_impl.h:361
Data import.
Definition: data_import.h:180
Dependent UserData.
Definition: user_data.h:597
TData * deriv(size_t s, size_t ip, size_t fct)
returns the derivatives of the local function, at ip
Definition: user_data.h:635
std::vector< std::vector< std::vector< std::vector< TData > > > > m_vvvvDeriv
Derivatives.
Definition: user_data.h:704
void resize_deriv_array()
resizes the derivative arrays for current number of ips.
Definition: user_data_impl.h:466
const TData * deriv(size_t s, size_t ip, size_t fct) const
returns the derivatives of the local function, at ip
Definition: user_data.h:639
std::vector< std::string > m_SymbFct
string of symbolic functions required
Definition: user_data.h:671
std::vector< size_t > m_vvNumDoFPerFct
number of functions and their dofs
Definition: user_data.h:700
virtual bool zero_derivative() const
returns that data depends on solution
Definition: user_data.h:647
DependentUserData(const std::string &symbFct)
Definition: user_data.h:614
virtual void local_ip_series_to_be_cleared()
implement callback, invoked when local ips are cleared
Definition: user_data_impl.h:535
TData & deriv(size_t s, size_t ip, size_t fct, size_t dof)
returns the derivative of the local function, at ip and for a dof
Definition: user_data.h:631
void extract_fct_grp()
extracts the function group
Definition: user_data_impl.h:410
virtual void local_ip_series_added(const size_t seriesID)
resizes the derivative field when local ip change is signaled
Definition: user_data_impl.h:525
const TData & deriv(size_t s, size_t ip, size_t fct, size_t dof) const
returns the derivative of the local function, at ip and for a dof
Definition: user_data.h:627
void check_s_ip_fct(size_t s, size_t ip, size_t fct) const
checks in debug mode the correct usage of indices
Definition: user_data_impl.h:511
static void set_zero(std::vector< std::vector< TData > > vvvDeriv[], const size_t nip)
sets all derivative values to zero
Definition: user_data_impl.h:491
DependentUserData(const std::vector< std::string > &symbFct)
Definition: user_data.h:615
size_t num_sh(size_t fct) const
number of shapes for local function
Definition: user_data.h:620
DependentUserData()
default constructor
Definition: user_data.h:609
DependentUserData(const char *symbFct)
Definition: user_data.h:613
CplUserData< TData, dim > base_type
Base class type.
Definition: user_data.h:600
virtual void set_function_pattern(ConstSmartPtr< FunctionPattern > fctPatt)
sets the associated function pattern
Definition: user_data_impl.h:384
virtual void update_dof_sizes(const LocalIndices &ind)
resize lin defect arrays
Definition: user_data_impl.h:451
void check_s_ip_fct_dof(size_t s, size_t ip, size_t fct, size_t dof) const
checks in debug mode the correct usage of indices
Definition: user_data_impl.h:518
void check_s_ip(size_t s, size_t ip) const
checks in debug mode the correct usage of indices
Definition: user_data_impl.h:502
virtual void local_ips_changed(const size_t seriesID, const size_t newNumIP)
implement callback, called when local IPs changed
Definition: user_data_impl.h:545
void set_functions(const char *symbFct)
Definition: user_data_impl.h:391
virtual bool requires_grid_fct() const
returns if grid function is needed for evaluation
Definition: user_data.h:650
Definition: function_group.h:52
void set_function_pattern(ConstSmartPtr< FunctionPattern > spFuncPattern)
set underlying function pattern
Definition: function_group.cpp:72
describes a mapping between two local index sets
Definition: function_group.h:186
size_t num_fct() const
returns the number of indices that are mapped
Definition: function_group.h:195
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
Base class for UserData.
Definition: user_data.h:260
const MathVector< dim > & ip(size_t s, size_t ip) const
returns global ip
Definition: user_data.h:401
int dim_local_ips() const
returns current local ip dimension
Definition: user_data.h:372
std::vector< const MathVector< 2 > * > m_pvLocIP2d
Definition: user_data.h:460
bool at_current_time(size_t s) const
returns true iff the time point specification is equal to the current one, or not specified
Definition: user_data_impl.h:221
ICplUserData()
default constructor
Definition: user_data_impl.h:46
void check_s(size_t s) const
checks in debug mode the correct usage of indices
Definition: user_data_impl.h:253
std::vector< const MathVector< dim > * > m_vvGlobPos
global ips
Definition: user_data.h:467
void set_subset(int si)
set the subset of evaluation
Definition: user_data.h:270
const MathVector< ldim > * local_ips(size_t s) const
returns local ips
Definition: user_data_impl.h:176
void clear()
clear all data
Definition: user_data_impl.h:57
virtual bool constant() const
returns if data is constant
Definition: user_data.h:289
size_t register_local_ip_series(const MathVector< ldim > *vPos, const size_t numIP, bool bMayChange=true)
set local positions without the specification of the time point, returns series id
Definition: user_data.h:346
virtual void compute(LocalVectorTimeSeries *u, GridObject *elem, const MathVector< dim > vCornerCoords[], bool bDeriv=false)=0
compute values (and derivatives iff compDeriv == true, but only for the 'current' time point)
int subset() const
returns the subset of evaluation
Definition: user_data.h:273
std::vector< int > m_vTimePoint
time points for the series
Definition: user_data.h:464
virtual void local_ip_series_to_be_cleared()
callback invoked, when local ips are cleared
Definition: user_data.h:423
void set_local_ips(const size_t seriesId, const MathVector< ldim > *vPos, const size_t numIP)
sets new local ip positions for a local ip series
Definition: user_data_impl.h:119
void set_time_point(size_t timePoint)
sets the current time point
Definition: user_data.h:279
int m_si
subset for evaluation
Definition: user_data.h:479
size_t time_point()
returns the current time point
Definition: user_data.h:282
number time(size_t s) const
get the specified evaluation time
Definition: user_data.h:389
std::vector< const MathVector< 1 > * > m_pvLocIP1d
local ips of dimension 1d-3d
Definition: user_data.h:459
std::vector< const MathVector< 3 > * > m_pvLocIP3d
Definition: user_data.h:461
number time() const
get the current evaluation time
Definition: user_data.h:285
virtual size_t num_needed_data() const
number of other Data this data depends on
Definition: user_data.h:292
virtual void local_ips_changed(const size_t seriesID, const size_t newNumIP)=0
callback invoked, if a local ip series has been changed
size_t m_timePoint
current time point (used if no explicit specification for series)
Definition: user_data.h:473
void check_s_ip(size_t s, size_t ip) const
checks in debug mode the correct usage of indices
Definition: user_data_impl.h:260
virtual void update_dof_sizes(const LocalIndices &ind)
resize arrays
Definition: user_data.h:320
virtual ~ICplUserData()
virtual desctructor
Definition: user_data.h:313
const std::vector< const MathVector< 2 > * > & get_local_ips(Int2Type< 2 >) const
Definition: user_data.h:445
virtual void compute(LocalVector *u, GridObject *elem, const MathVector< dim > vCornerCoords[], bool bDeriv=false)=0
compute values (and derivatives iff compDeriv == true)
std::vector< size_t > m_vNumIP
number of evaluation points (-1 indicates no ips set)
Definition: user_data.h:453
std::vector< number > m_vTime
time for evaluation
Definition: user_data.h:470
std::vector< const MathVector< 3 > * > & get_local_ips(Int2Type< 3 >)
Definition: user_data.h:443
std::vector< const MathVector< 1 > * > & get_local_ips(Int2Type< 1 >)
help function to get local ips
Definition: user_data.h:441
virtual SmartPtr< ICplUserData > needed_data(size_t i)
return needed data
Definition: user_data.h:295
size_t num_ip(size_t s) const
returns the number of integration points
Definition: user_data.h:327
const MathVector< dim > * ips(size_t s) const
returns global ips
Definition: user_data.h:398
virtual void global_ips_changed(const size_t seriesID, const MathVector< dim > *vPos, const size_t numIP)
callback invoked after global ips have been changed
Definition: user_data.h:431
const std::vector< const MathVector< 1 > * > & get_local_ips(Int2Type< 1 >) const
Definition: user_data.h:444
int m_defaultTimePoint
default time point (or -1 if not specified)
Definition: user_data.h:476
virtual void local_ip_series_added(const size_t seriesID)
callback invoked after local ips have been added to the series
Definition: user_data.h:417
size_t register_local_ip_series(const MathVector< ldim > *vPos, const size_t numIP, const int timePointSpec, bool bMayChange=true)
set local positions, returns series id
Definition: user_data_impl.h:71
size_t num_series() const
returns the number of ip series
Definition: user_data.h:324
int m_locPosDim
dimension of local position (-1 indicates no dim set)
Definition: user_data.h:456
void set_global_ips(size_t s, const MathVector< dim > *vPos, size_t numIP)
set global positions
Definition: user_data_impl.h:232
int time_point_specification(size_t s) const
returns the time point specification (note: it may be -1, i.e. not specified)
Definition: user_data_impl.h:201
virtual bool zero_derivative() const
returns if data depends on solution
Definition: user_data.h:317
const MathVector< ldim > & local_ip(size_t s, size_t ip) const
returns local ip
Definition: user_data_impl.h:189
void set_times(const std::vector< number > &vTime)
set evaluation time
Definition: user_data.h:276
std::vector< const MathVector< 2 > * > & get_local_ips(Int2Type< 2 >)
Definition: user_data.h:442
std::vector< bool > m_vMayChange
flags if local ips may change
Definition: user_data.h:450
virtual void check_setup() const
returns if the dependent data is ready for evaluation
Definition: user_data.h:310
const std::vector< const MathVector< 3 > * > & get_local_ips(Int2Type< 3 >) const
Definition: user_data.h:446
Definition: local_algebra.h:50
Definition: local_algebra.h:198
time series of local vectors
Definition: solution_time_series.h:167
A class for fixed size, dense matrices.
Definition: math_matrix.h:52
a mathematical Tensor of rank TRank and N entries.
Definition: math_tensor.h:56
a mathematical Vector with N entries.
Definition: math_vector.h:97
Type based UserData.
Definition: user_data.h:143
TRet return_type
Definition: user_data.h:146
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< 3 > vLocIP[], const size_t nip, LocalVector *u, const MathMatrix< 3, dim > *vJT=NULL) const =0
std::string type() const
returns type of data as string (e.g. "Number", "Vector", "Matrix")
Definition: user_data.h:152
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< 1 > vLocIP[], const size_t nip, LocalVector *u, const MathMatrix< 1, dim > *vJT=NULL) const =0
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< 2 > vLocIP[], const size_t nip, LocalVector *u, const MathMatrix< 2, dim > *vJT=NULL) const =0
virtual bool requires_grid_fct() const =0
returns if grid function is needed for evaluation
virtual bool continuous() const =0
returns if provided data is continuous over geometric object boundaries
TData data_type
Definition: user_data.h:145
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, const size_t nip) const =0
returns values for global positions
int get_dim() const
returns dimension
Definition: user_data.h:149
virtual TRet operator()(TData &value, const MathVector< dim > &globIP, number time, int si) const =0
returns value for a global position
base class providing runtime-info on dimension and type
Definition: user_data.h:51
virtual std::string type() const =0
returns type of data as string (e.g. "Number", "Vector", "Matrix")
virtual int get_dim() const =0
returns dimension
const FunctionGroup & function_group() const
Function Group of functions.
Definition: user_data.h:75
const char * obj_name()
gets the name of the object (s. the field m_objName)
Definition: user_data.h:102
virtual bool requires_grid_fct() const =0
returns if grid function is needed for evaluation
FunctionIndexMapping m_map
Mapping for import fct.
Definition: user_data.h:109
const FunctionIndexMapping & map() const
get function mapping
Definition: user_data.h:78
FunctionGroup m_fctGrp
functions the data depends on
Definition: user_data.h:106
virtual bool continuous() const =0
returns if provided data is continuous over geometric object boundaries
virtual ~UserDataInfo()
virtual destructor
Definition: user_data.h:63
void set_obj_name(const char *name)
sets the name of the object (s. the field m_objName)
Definition: user_data.h:87
size_t num_fct() const
number of functions this export depends on
Definition: user_data.h:81
virtual void set_function_pattern(ConstSmartPtr< FunctionPattern > fctPatt)
sets the function pattern for a possibly needed grid function
Definition: user_data.h:70
SmartPtr< char > m_objName
This field is used mainly for debugging: One can assign a name to the object to identify it when runn...
Definition: user_data.h:112
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
static const int dim
const NullSmartPtr SPNULL
The equivalent to NULL for smart pointers.
Definition: smart_pointer.h:90
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
the ug namespace
function func(x, y, z, t, si)
Definition: metaprogramming_util.h:42
static std::string name()
Definition: user_data.h:127
static std::string name()
Definition: user_data.h:129
static std::string name()
Definition: user_data.h:125
static std::string name()
Definition: user_data.h:123
Definition: user_data.h:121
static std::string name()
Definition: user_data.h:121