SheafSystem  0.0.0.0
section_evaluator.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 section_evaluator
19 
20 #ifndef SECTION_EVALUATOR_H
21 #define SECTION_EVALUATOR_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef ANY_H
28 #include "SheafSystem/any.h"
29 #endif
30 
31 #ifndef FIBER_BUNDLE_H
32 #include "SheafSystem/fiber_bundle.h"
33 #endif
34 
35 #ifndef POD_TYPES_H
36 #include "SheafSystem/pod_types.h"
37 #endif
38 
39 namespace sheaf
40 {
41 template <typename T> class block;
42 }
43 
44 namespace fiber_bundle
45 {
46 
47 using namespace sheaf;
48 
53 class SHEAF_DLL_SPEC section_evaluator : public any
54 {
55 
56  // ===========================================================
58  // ===========================================================
60 
61 public:
62 
63  // The following types are derived from the role the evaluators play
64  // in the section space classes. The domain of an evaluator must be
65  // a local chart of a base space and the range must be a fiber space.
66  // Hence the coord type here must be chart_point::coord_type and the value
67  // type here must be vd::value_type. Although it is tempting to make a
68  // similar argument about the dof type, the sections and the fibers don't
69  // actually share representations or dofs anywhere, so there is no reason
70  // in principle they need to be the same type. In practice, of course,
71  // everything is a double.
72 
78 
84 
89 
93 
98  section_evaluator(const section_evaluator& xother);
99 
103  virtual ~section_evaluator();
104 
105 protected:
106 
112 
113 private:
114 
116 
117  // ===========================================================
119  // ===========================================================
121 
122 public:
123 
128  virtual int db() const = 0;
129 
133  virtual void local_coordinates(pod_index_type xindex,
134  coord_type xresult[],
135  size_type xresult_ub) const = 0;
136 
140  void local_coordinates(pod_index_type xindex, block<coord_type>& xresult) const;
141 
145  virtual void center(coord_type xresult[], size_type xresult_ub) const;
146 
150  void center(block<coord_type>& xresult) const;
151 
155  virtual bool in_standard_domain(const dof_type xlocal_coords[],
156  size_type xlocal_coords_ub) const = 0;
157 
161  bool in_standard_domain(const block<dof_type>& xlocal_coords) const;
162 
163 protected:
164 
165 private:
166 
168 
169  // ===========================================================
171  // ===========================================================
173 
174 public:
175 
180  virtual size_type dof_ct() const = 0;
181 
187  bool df_is_variable() const;
188 
192  virtual int df() const;
193 
198  virtual dof_type value_at_coord(const dof_type xdofs[],
199  size_type xdofs_ub,
200  const dof_type xlocal_coords[],
201  size_type xlocal_coords_ub) const;
202 
207  dof_type value_at_coord(const block<dof_type>& xdofs,
208  const block<dof_type>& xlocal_coords) const;
209 
214  virtual void value_at_coord(const dof_type xdofs[],
215  size_type xdofs_ub,
216  const dof_type xlocal_coords[],
217  size_type xlocal_coords_ub,
218  dof_type xresult[],
219  size_type xresult_ub) const = 0;
224  void value_at_coord(const block<dof_type>& xdofs,
225  const block<dof_type>& xlocal_coords,
226  block<dof_type>& xresult) const;
232  virtual void coord_at_value(const dof_type xdofs[],
233  size_type xdofs_ub,
234  const dof_type xvalue[],
235  size_type xvalue_ub,
236  dof_type xlocal_coords[],
237  size_type xlocal_coords_ub) const = 0;
238 
244  void coord_at_value(const block<dof_type>& xdofs,
245  const block<dof_type>& xvalue,
246  block<dof_type>& xlocal_coords) const;
247 
251  virtual dof_type min(const dof_type xdofs[], size_type xdofs_ub) const;
252 
256  dof_type min(const block<dof_type>& xdofs) const;
257 
261  virtual void min(const dof_type xdofs[],
262  size_type xdofs_ub,
263  dof_type xresult[],
264  size_type xresult_ub) const;
265 
269  void min(const block<dof_type>& xdofs, block<dof_type>& xresult) const;
270 
274  virtual dof_type max(const dof_type xdofs[], size_type xdofs_ub) const;
275 
279  dof_type max(const block<dof_type>& xdofs) const;
280 
284  virtual void max(const dof_type xdofs[],
285  size_type xdofs_ub,
286  dof_type xresult[],
287  size_type xresult_ub) const;
288 
292  void max(const block<dof_type>& xdofs, block<dof_type>& xresult) const;
293 
294 protected:
295 
296 private:
297 
299 
300 
301  // ===========================================================
303  // ===========================================================
305 
306 public:
307 
312  virtual section_evaluator* clone() const = 0;
313 
318  virtual section_evaluator& operator=(const section_evaluator& xother);
319 
323  virtual bool invariant() const;
324 
328  virtual bool is_ancestor_of(const any* other) const;
329 
330 protected:
331 
332 private:
333 
335 
336 };
337 
338 //==============================================================================
339 // NON-MEMBER FUNCTIONS
340 //==============================================================================
341 
346 size_t
347 SHEAF_DLL_SPEC
348 deep_size(const section_evaluator& xe, bool xinclude_shallow = true);
349 
350 
351 } // namespace fiber_bundle
352 
353 #endif // ifndef SECTION_EVALUATOR_H
double chart_point_coord_type
The type of local coordinate in the base space; the scalar type for the local coordinate vector space...
Definition: fiber_bundle.h:57
sec_vd_dof_type dof_type
The type of degree of freedom.
Abstract base class with useful features for all objects.
Definition: any.h:39
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
chart_point_coord_type coord_type
The type of local coordinate; the scalar type for the local coordinate vector space.
vd_value_type value_type
The type of component in the value; the scalar type in the range vector space.
SHEAF_DLL_SPEC void max(const vd &x0, vd_value_type &xresult, bool xauto_access)
Maximum component of x0, pre-allocated version.
Definition: vd.cc:2097
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
SHEAF_DLL_SPEC void min(const vd &x0, vd_value_type &xresult, bool xauto_access)
Minimum component of x0, pre-allocated version.
Definition: vd.cc:2161
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Namespace for the sheaves component of the sheaf system.
double sec_vd_dof_type
The type of degree of freedom in the section space.
Definition: fiber_bundle.h:78
An auto_block with a no-initialization initialization policy.
Namespace for the fiber_bundles component of the sheaf system.
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: fiber_bundle.h:63