SheafSystem  0.0.0.0
sparse_field_dof_map.h
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // $$SCRIBBLE: remove this class from build.
19 
20 // Interface for class sparse_field_dof_map;
21 // This representation uses contiguous storage with
22 // the fiber index varying most rapidly
23 
24 #ifndef SPARSE_FIELD_DOF_MAP_H
25 #define SPARSE_FIELD_DOF_MAP_H
26 
27 #ifndef SHEAF_DLL_SPEC_H
28 #include "SheafSystem/sheaf_dll_spec.h"
29 #endif
30 
31 #ifndef FIELD_DOF_MAP_H
32 #include "SheafSystem/field_dof_map.h"
33 #endif
34 
35 namespace sheaf
36 {
37 class dof_map_factory;
38 }
39 
40 namespace fiber_bundle
41 {
42 
43 class sec_rep_space;
44 
45 
52 class SHEAF_DLL_SPEC sparse_field_dof_map : public field_dof_map
53 {
54 
55 public:
56 
60  virtual const std::string& class_name() const;
61 
65  static const std::string& static_class_name();
66 
67  // ===========================================================
68  // CANONICAL FACET
69  // ===========================================================
70 
75 
79  virtual sparse_field_dof_map* clone() const;
80 
85 
89  virtual sparse_field_dof_map* copy() const;
90 
94  sparse_field_dof_map& operator=(const sparse_field_dof_map& xother);
95 
99  virtual ~sparse_field_dof_map();
100 
104  virtual bool invariant() const;
105 
106  // ===========================================================
107  // MAP FACET
108  // ===========================================================
109 
113  sparse_field_dof_map(const sec_rep_space* xhost, double xdefault_value = 0.0);
114 
115 
116 
120  virtual dof_tuple_type type_id() const
121  {
122  return SPARSE_FIELD_DOF_TUPLE_ID;
123  };
124 
128  inline double default_value() const
129  {
130  return _def_val;
131  };
132 
133  using field_dof_map::get_dof;
134  using field_dof_map::put_dof;
135 
140  virtual void get_dof(const scoped_index& xid, bool xis_poset_id,
141  void *xbuf, size_t xbuf_len) const;
142 
147  virtual void put_dof(const scoped_index& xid, bool xis_poset_id,
148  const void *xbuf, size_t xbuf_len);
149 
155  virtual void get_dofs(const client_index* xclient_ids, int xclient_id_ct,
156  void* xbuf, size_t xbuf_len) const;
157 
163  virtual void put_dofs(const client_index* xclient_ids, int xclient_id_ct,
164  const void* xbuf, size_t xbuf_len);
165 
172  virtual void get_dof(const scoped_index& xbase_id,
173  const scoped_index& xfiber_id,
174  const scoped_index& xmult_id,
175  bool xis_poset_id,
176  void* xbuf, size_t xbuf_len) const;
177 
184  virtual void put_dof(const scoped_index& xbase_id,
185  const scoped_index& xfiber_id,
186  const scoped_index& xmult_id,
187  bool xis_poset_id,
188  const void* xbuf, size_t xbuf_len);
189 
195  virtual void get_dofs(const client_index* xclient_base_ids, int xclient_base_id_ct,
196  const client_index* xclient_fiber_ids, int xclient_fiber_id_ct,
197  void* xbuf, size_t xbuf_len) const;
198 
204  virtual void put_dofs(const client_index* xclient_base_ids, int xclient_base_id_ct,
205  const client_index* xclient_fiber_ids, int xclient_fiber_id_ct,
206  const void* xbuf, size_t xbuf_len);
207 
215  virtual void get_discretization_dofs(const scoped_index& xdisc_id,
216  bool xis_poset_id,
217  void* xbuf,
218  size_t xbuf_len) const;
226  virtual void put_discretization_dofs(const scoped_index& xdisc_id,
227  bool xis_poset_id,
228  const void* xbuf,
229  size_t xbuf_len);
238  virtual void get_component_dofs(void* xbuf,
239  size_t xbuf_len,
240  const scoped_index& xcomp_id,
241  const scoped_index* xdisc_ids = 0,
242  size_type xdisc_ids_ct = 0) const;
243 
252  virtual void put_component_dofs(const void* xbuf,
253  size_t xbuf_len,
254  const scoped_index& xcomp_id,
255  const scoped_index* xdisc_ids = 0,
256  size_type xdisc_ids_ct = 0);
257 
269  virtual void get_component_dofs(void* xbuf,
270  size_t xbuf_len,
271  const client_index& xcomp_id,
272  const id_map* xcomp_client_id_map,
273  const client_index* xdisc_ids = 0,
274  size_type xdisc_ids_ct = 0,
275  const id_map* xdisc_client_id_map = 0) const;
276 
288  virtual void put_component_dofs(const void* xbuf,
289  size_t xbuf_len,
290  const client_index& xcomp_id,
291  const id_map* xcomp_client_id_map,
292  const client_index* xdisc_ids = 0,
293  size_type xdisc_ids_ct = 0,
294  const id_map* xdisc_client_id_map = 0);
298  virtual void* dof_tuple();
299 
303  virtual const void* dof_tuple() const;
304 
308  virtual void get_dof_tuple(void* xbuf, size_t xbuflen) const;
309 
313  virtual void put_dof_tuple(const void* xbuf, size_t xbuflen);
314 
315 
316  // ===========================================================
317  // I/O SUPPORT FACET
318  // ===========================================================
319 
324  virtual bool supports_xfr_opt() const;
325 
326 protected:
327 
331  virtual void allocate_dofs();
332 
333 private:
334 
338  typedef unordered::unordered_map<pod_index_type, double> val_map_type;
339 
343  val_map_type _val_map;
344 
348  double _def_val;
349 
354  static bool _has_prototype;
355 
359  static bool make_prototype();
360 
361 };
362 
363 } // namespace fiber_bundle
364 
365 #endif // ifndef SPARSE_FIELD_DOF_MAP_H
double default_value() const
The default value; the value for dofs that are not stored in _val_map.
OBSOLETE: Use array_sec_vd_dof_map or sparse_section_dof_map. The abstract map from section_space_sch...
Definition: field_dof_map.h:48
OBSOLETE: Use array_sec_vd_dof_map or sparse_section_dof_map. A representation of the abstract map fr...
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
virtual dof_tuple_type type_id() const
An identifer for the type of dof tuple this is.
dof_tuple_type
Identifiers for dof tuple types.
Namespace for the sheaves component of the sheaf system.
Namespace for the fiber_bundles component of the sheaf system.
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61