SheafSystem  0.0.0.0
pullback_map.h
Go to the documentation of this file.
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 
20 
21 #ifndef PULLBACK_MAP_H
22 #define PULLBACK_MAP_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef CHART_POINT_3D_H
29 #include "SheafSystem/chart_point_3d.h"
30 #endif
31 
32 #ifndef STD_UNORDERED_SET_H
33 #include "SheafSystem/std_unordered_set.h"
34 #endif
35 
36 namespace fields
37 {
38 
39 using namespace fiber_bundle;
40 
44 class SHEAF_DLL_SPEC pullback_map_entry
45 {
46 
47  // =============================================================================
49  // =============================================================================
51 
52 public:
53 
58 
63 
68 
74  {
75  domain_pt.put_chart_id(xchart_id);
76  };
77 
82  pullback_map_entry(const scoped_index& xchart_id)
83  {
84  domain_pt.put_chart_id(xchart_id.hub_pod());
85  };
86 
90  pullback_map_entry(const scoped_index& xdisc_id, chart_point_3d xdomain_pt)
91  {
92  disc_id = xdisc_id;
93  domain_pt = xdomain_pt;
94  };
95 
100  bool operator==(const pullback_map_entry& xother) const
101  {
102  return domain_pt.chart_id() == xother.domain_pt.chart_id();
103  };
104 
106 };
107 
111 struct SHEAF_DLL_SPEC discretization_hash
112 {
116  size_t operator()(const pullback_map_entry& x) const
117  {
118  // Chart ids may be in different id spaces,
119  // but we have to hash them in some specific
120  // id space; poset internal id space is the
121  // obvious candidate.
122 
123  return x.domain_pt.chart_id();
124  };
125 };
126 
130 class SHEAF_DLL_SPEC pullback_map : public
131 unordered::unordered_multiset<pullback_map_entry, discretization_hash> {};
132 
133 // ===========================================================
134 // NON-MEMBER FUNCTIONS
135 // ===========================================================
136 
140 std::ostream& operator<<(std::ostream& xos, const pullback_map_entry& xentry);
141 
142 } // namespace fields
143 
144 #endif // ifndef PULLBACK_MAP_H
size_t operator()(const pullback_map_entry &x) const
Hash the chart id associated with the map entry x.
Definition: pullback_map.h:116
A point in a 3D chart space.
Namespace for fields component of sheaf system.
void put_chart_id(pod_index_type xchart)
Sets chart_id() to xchart_id.
Definition: chart_point.cc:103
pod_index_type chart_id() const
The id of the chart this point is in.
Definition: chart_point.cc:96
A hash function class for discretization map entries.
Definition: pullback_map.h:111
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
pullback_map_entry()
Default constructor; creates an instance with unspecied values.
Definition: pullback_map.h:67
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &xos, const field_at0 &xfield)
Inserts field_at0 xfield into ostream xos.
Definition: field_at0.cc:535
An entry in a discretization map.
Definition: pullback_map.h:44
chart_point_3d domain_pt
The location of the discretization member.
Definition: pullback_map.h:62
pullback_map_entry(const scoped_index &xdisc_id, chart_point_3d xdomain_pt)
Creates an instance with disc_id == xdisc_id and domain_pt == xdomain_pt.
Definition: pullback_map.h:90
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
bool operator==(const pullback_map_entry &xother) const
True if domain_pt.chart == xother.domain_pt.chart; equality operator for pullback map...
Definition: pullback_map.h:100
A map from members of a discretization subposet to points in a base space.
Definition: pullback_map.h:130
scoped_index disc_id
The id of a discretization member.
Definition: pullback_map.h:57
pullback_map_entry(pod_index_type xchart_id)
Creates an instance with domain_pt().chart_id == xchart_id and other values uninitalized.
Definition: pullback_map.h:73
pullback_map_entry(const scoped_index &xchart_id)
Creates an instance with domain_pt().chart_id == xchart_id.hub_pod() and other values uninitalized...
Definition: pullback_map.h:82
Namespace for the fiber_bundles component of the sheaf system.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710