SheafSystem  0.0.0.0
section_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/section_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 // SECTION_PUSHER_PULLBACK_ACTION FACET
36 // ===========================================================
37 
40  pb_map_type& xmap)
41  : _domain_coords(xglobal_coords),
42  _pb_map(xmap)
43 {
44 
45  // Preconditions:
46 
47  require(xglobal_coords.state_is_read_accessible());
48 
49  // Body:
50 
52  {
53  // Initialize inversion using defaults.
54 
56  }
57 
58  _pb.disc_id.invalidate();
59  _pb.domain_pt.put(scoped_index::INVALID(), 0.0, 0.0, 0.0);
60 
61 
62  // Postconditions:
63 
64  ensure(&domain_coords() == &xglobal_coords);
65  ensure(domain_coords().is_invertible());
66 
67  // Exit:
68 
69  return;
70 }
71 
74 {
75  // Preconditions:
76 
77  // Body:
78 
79  // Nothing to do.
80 
81  // Postconditions:
82 
83  // Exit:
84 
85  return;
86 }
87 
88 
89 void
92 {
93  // Preconditions:
94 
95  require(domain_coords().state_is_read_accessible());
96  require(domain_coords().is_invertible());
97 
98  // Body:
99 
100  _pb.disc_id = xdisc_id;
101 
102  // Invert the domain global coordinates to get the pull back of
103  // the range discretization point into domain local coordinates.
104 
105  _domain_coords.point_at_value_ua(xcoords.base(), xcoords.ub(), _pb.domain_pt);
106 
107 #ifdef DIAGNOSTIC_OUTPUT
108 
109  cout << "in pb push action: coords: ";
110  for(int i=0; i< xcoords.ct(); ++i)
111  {
112  cout << setw(10) << xcoords[i];
113  }
114  cout << " pb map entry:" << _pb << endl;
115 #endif
116 
117  // Insert the pullback in the pullback map.
118 
119  _pb_map.insert(_pb);
120 
121  // Postconditions:
122 
123 
124  // Exit:
125 
126  return;
127 }
128 
132 {
133  // Preconditions:
134 
135  // Body:
136 
137  geometry::sec_ed_invertible& result = _domain_coords;
138 
139  // Postconditions:
140 
141  // Exit:
142 
143  return result;
144 }
145 
146 
147 // ===========================================================
148 // NON-MEMBER FUNCTIONS
149 // ===========================================================
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.
bool is_invertible() const
True if this can be inverted.
STL namespace.
virtual void point_at_value_ua(const sec_vd_dof_type *xvalue, size_type xvalue_ub, chart_point &xresult)
Finds a chart point which is the preimage in this of xvalue; unattached version.
void invalidate()
Make this id invalid.
Definition: scoped_index.h:852
An abstract invertible section of a fiber bundle with a d-dimensional base space and a d-dimensional ...
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
static const scoped_index & INVALID()
The invalid id.
Definition: scoped_index.h:871
chart_point_3d domain_pt
The location of the discretization member.
Definition: pullback_map.h:62
section_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.
void put(pod_index_type xchart_id, coord_type xu, coord_type xv, coord_type xw)
Sets chart_id() == xchart_id, u() == xu, v() == xv, w() == xw.
geometry::sec_ed_invertible & domain_coords()
The global coordinates of the domain.
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
virtual void operator()(const scoped_index &xdisc_id, block< sec_vd_value_type > &xglobal_coords)
The push action.