SheafSystem  0.0.0.0
array_section_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 // Interface for class array_section_dof_map;
19 // map from client dof id to dof value.
20 // The section_dof_map interface assumes dofs
21 // are indexed by (base id, fiber id) pairs.
22 // This representation uses contiguous storage with
23 // the fiber index varying most rapidly
24 
25 #ifndef ARRAY_SECTION_DOF_MAP_H
26 #define ARRAY_SECTION_DOF_MAP_H
27 
28 #ifndef SHEAF_DLL_SPEC_H
29 #include "SheafSystem/sheaf_dll_spec.h"
30 #endif
31 
32 #ifndef SECTION_DOF_MAP_H
33 #include "SheafSystem/section_dof_map.h"
34 #endif
35 
36 namespace fiber_bundle
37 {
38 
39 class sec_rep_space;
40 
46 class SHEAF_DLL_SPEC array_section_dof_map : public section_dof_map
47 {
48 
49  friend class fiber_bundles_namespace;
50 
51 public:
52 
56  virtual const std::string& class_name() const;
57 
61  static const std::string& static_class_name();
62 
63  // ===========================================================
64  // CANONICAL FACET
65  // ===========================================================
66 
71 
75  virtual array_section_dof_map* clone() const;
76 
81 
85  virtual array_section_dof_map* copy() const;
86 
90  array_section_dof_map& operator=(const array_section_dof_map& xother);
91 
95  virtual ~array_section_dof_map();
96 
100  virtual bool invariant() const;
101 
102  // ===========================================================
103  // MAP FACET
104  // ===========================================================
105 
111  array_section_dof_map(sec_rep_space* xhost, void* xdofs = 0, size_t xdofs_ub = 0);
112 
120  pod_index_type xbase_id,
121  int xversion,
122  void* xdofs = 0,
123  size_t xdofs_ub = 0);
124 
132  const scoped_index& xbase_id,
133  int xversion,
134  void* xdofs = 0,
135  size_t xdofs_ub = 0);
136 
140  virtual dof_tuple_type type_id() const
141  {
142  return ARRAY_SECTION_DOF_TUPLE_ID;
143  };
144 
147 
148  // ===========================================================
150  // ===========================================================
152 
153 public:
154 
159  virtual bool dof_in_bounds(pod_index_type xdof_id, bool xis_table_dofs) const;
160 
166  virtual bool dof_in_bounds(pod_index_type xdisc_id, pod_index_type xfiber_id, bool xis_table_dofs) const;
167 
171  virtual void get_dof(pod_index_type xdof_id, void* xdof, size_type xdof_size) const;
172 
176  virtual void put_dof(pod_index_type xdof_id, const void* xdof, size_type xdof_size);
177 
181 
185  virtual void get_dof(pod_index_type xdisc_id,
186  pod_index_type xfiber_dof_id,
187  void* xdof,
188  size_type xdof_size) const;
189 
193  virtual void put_dof(pod_index_type xdisc_id,
194  pod_index_type xfiber_dof_id,
195  const void* xdof,
196  size_type xdof_size);
197 
202  virtual bool fiber_in_bounds(pod_index_type xdisc_id, bool xis_table_dofs) const;
203 
207  void reserve_fiber(pod_index_type xdisc_id);
208 
212  virtual void get_fiber(pod_index_type xdisc_id, void* xfiber, size_type xfiber_size) const;
213 
217  virtual void put_fiber(pod_index_type xdisc_id, const void* xfiber, size_type xfiber_size);
218 
223  virtual void force_fiber(pod_index_type xdisc_id, const void* xfiber, size_type xfiber_size);
224 
228  virtual void get_component(pod_index_type xfiber_dof_id, void* xcomponent, size_type xcomponent_size) const;
229 
233  virtual void put_component(pod_index_type xfiber_dof_id, const void* xcomponent, size_type xcomponent_size);
234 
235 protected:
236 
237 private:
238 
242  void* dof_ptr(pod_index_type xdof_id, bool xis_table_dofs) const
243  {
244  return _dofs + schema().offset(xdof_id, xis_table_dofs);
245  }
246 
250  void* dof_ptr(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, bool xis_table_dofs) const
251  {
252  return _dofs + schema().offset(xdisc_id, xfiber_dof_id, xis_table_dofs);
253  }
254 
255 
257 
258 public:
259 
263  virtual void* dof_tuple();
264 
268  virtual const void* dof_tuple() const;
269 
273  virtual void get_dof_tuple(void* xbuf, size_t xbuflen) const;
274 
278  virtual void put_dof_tuple(const void* xbuf, size_t xbuflen);
279 
280 
281 protected:
282 
286  virtual void allocate_dofs();
287 
288 private:
289 
293  int _fiber_dof_ct;
294 
298  int _local_ct;
299 
300 
301  // Needed for fiber_bundle::array_section_dof_map::copy_dof(const scoped_index&, const scoped_index&,
302  // const scoped_index&, bool, void*, size_t, bool) const
303 
308  mutable dof_descriptor_array::dof_descriptor* _xfr_desc;
309 
313  char* _dofs;
314 
318  bool _this_owns_dofs;
319 
323  void init_dofs(void* xdofs, size_t xdofs_ub);
324 
328  static bool make_prototype();
329 
333  void reserve(size_t xdof_tuple_ub);
334 };
335 
336 } // namespace fiber_bundle
337 
338 #endif // ifndef ARRAY_SECTION_DOF_MAP_H
The abstract map from section dof ids to section dof values of heterogeneous type.
virtual void get_dof(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, void *xdof, size_type xdof_size) const =0
Copies the dof referred to by xdisc_id, xfiber_dof_id into xdof.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
virtual dof_tuple_type type_id() const
An identifer for the type of dof tuple this is.
A contiguous tuple, contiguous fiber representation of the abstract map from section dof ids to secti...
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
dof_tuple_type
Identifiers for dof tuple types.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
virtual void put_dof(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, const void *xdof, size_type xdof_size)=0
Sets the dof referred to by xdof_id to the value at xdof.
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