SheafSystem  0.0.0.0
body_pusher_pullback_action.cc
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 #include "SheafSystem/body_pusher_pullback_action.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/block.h"
25 #include "SheafSystem/error_message.h"
26 #include "SheafSystem/sec_ed_invertible.h"
27 
28 using namespace std;
29 using namespace fields; // Workaround for MS C++ bug.
30 
31 // #define DIAGNOSTIC_OUTPUT 1
32 
33 
34 // ===========================================================
35 // BODY_PUSHER_PULLBACK_ACTION FACET
36 // ===========================================================
37 
38 // PUBLIC MEMBER FUNCTIONS
39 
42  : _domain_coords(xglobal_coords),
43  _pb_map(xmap)
44 {
45 
46  // Preconditions:
47 
48  require(xglobal_coords.state_is_read_accessible());
49 
50  // Body:
51 
53  {
54  // Initialize inversion using defaults.
55 
57  }
58 
59  // Reserve some initial space in _domain_pts; will resize if needed.
60 
61  _domain_pts.reserve(32);
62 
63  // Postconditions:
64 
65  ensure(&domain_coords() == &xglobal_coords);
66  ensure(domain_coords().is_invertible());
67 
68  // Exit:
69 
70  return;
71 }
72 
75 {
76  // Preconditions:
77 
78  // Body:
79 
80  // Nothing to do.
81 
82  // Postconditions:
83 
84  // Exit:
85 
86  return;
87 }
88 
89 
90 void
93 {
94  // Preconditions:
95 
96  require(domain_coords().state_is_read_accessible());
97  require(domain_coords().is_invertible());
98 
99  // Body:
100 
101  // Invert the domain global coordinates to get the pull back of
102  // the range discretization point into domain local coordinates.
103 
104  _domain_pts.set_ct(0);
105  _domain_coords.all_points_at_value_ua(xcoords.base(), xcoords.ub(), _domain_pts);
106 
107  _pb.disc_id = xdisc_id;
108 
109 #ifdef DIAGNOSTIC_OUTPUT
110 
111  cout << "in body pusher pb action: disc id = " << xdisc_id;
112 
113  cout << "\tcoords: ";
114  for(int i=0; i< xcoords.ct(); ++i)
115  {
116  cout << setw(10) << xcoords[i];
117  }
118 
119  cout << "\tpb ct = " << _domain_pts.ct() << endl;
120 #endif
121 
122  for(size_type i=0; i<_domain_pts.ct(); ++i)
123  {
124  _pb.domain_pt = _domain_pts[i];
125 
126 #ifdef DIAGNOSTIC_OUTPUT
127 
128  cout << "\tpb map entry: " << _pb << endl;
129 #endif
130 
131  // Insert the pullback in the pullback map.
132 
133  _pb_map.insert(_pb);
134 
135  }
136 
137 
138  // Postconditions:
139 
140 
141  // Exit:
142 
143  return;
144 }
145 
149 {
150  // Preconditions:
151 
152  // Body:
153 
154  geometry::sec_ed_invertible& result = _domain_coords;
155 
156  // Postconditions:
157 
158  // Exit:
159 
160  return result;
161 }
162 
163 
164 // ===========================================================
165 // NON-MEMBER FUNCTIONS
166 // ===========================================================
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
size_type ct() const
The number of items currently in use.
Namespace for fields component of sheaf system.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
virtual void initialize_point_locator(bool xauto_access)
Initializes point locater search structure using default values.
body_pusher_pullback_action(geometry::sec_ed_invertible &xglobal_coords, pb_map_type &xmap)
Creates an instance using global coordinates xdomain_coords and pullback map xmap.
bool is_invertible() const
True if this can be inverted.
STL namespace.
virtual void operator()(const scoped_index &xdisc_id, block< sec_vd_value_type > &xglobal_coords)
The push action.
An abstract invertible section of a fiber bundle with a d-dimensional base space and a d-dimensional ...
virtual void all_points_at_value_ua(const sec_vd_value_type *xvalue, size_type xvalue_ub, block< chart_point_3d > &xresult)
Finds all chart points at which this has value xvalue and appends them to xresult. Note that charts overlap at their boundaries and hence if xvalue lies on a boundary it is contained in more than one chart.
pointer_type base() const
The underlying storage array.
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
chart_point_3d domain_pt
The location of the discretization member.
Definition: pullback_map.h:62
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
geometry::sec_ed_invertible & domain_coords()
The global coordinates of the domain.