SheafSystem  0.0.0.0
put_property_dofs_fcn_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/put_property_dofs_fcn_action.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/block.h"
25 #include "SheafSystem/error_message.h"
26 #include "SheafSystem/sec_vd.h"
27 
28 using namespace fields; // Workaround for MS C++ bug.
29 
30 // #define DIAGNOSTIC_OUTPUT 1
31 
32 
33 // ===========================================================
34 // PUT_PROPERTY_DOFS_FCN_ACTION FACET
35 // ===========================================================
36 
37 // PUBLIC MEMBER FUNCTIONS
38 
42  bool xauto_access)
43  : put_property_dofs_action(xproperty, xauto_access)
44 {
45  // Preconditions:
46 
47  require(xauto_access || xproperty.state_is_read_accessible());
48 
49  // Body:
50 
51  _dof_function = xfcn;
52 
53  // Postconditions:
54 
55  // Exit:
56 
57  return;
58 }
59 
62 {
63  // Preconditions:
64 
65  // Body:
66 
67  // Nothing to do.
68 
69  // Postconditions:
70 
71  // Exit:
72 
73  return;
74 }
75 
76 
77 void
80 {
81  // Preconditions:
82 
83  require(property().state_is_read_write_accessible());
84 
85  // Body:
86 
87  // Evaluate the property dof function at
88  // the global coordinates of the discretization member.
89 
90  _dof_function(xcoords, _dofs);
91 
92 #ifdef DIAGNOSTIC_OUTPUT
93 
94  cout << "in put_property_dofs_fcn_action: coords: " << xcoords
95  << "dofs: " << _dofs
96  << endl;
97 #endif
98 
99  // Scatter the dofs into the property section.
100 
101  property().put_fiber(xdisc_id.pod(), _dofs.base(), _dofs.ct()*sizeof(sec_vd_dof_type));
102 
103  // Postconditions:
104 
105 
106  // Exit:
107 
108  return;
109 }
110 
114 {
116 
117  // Preconditions:
118 
119  // Body:
120 
121  result = _dof_function;
122 
123  // Postconditions:
124 
125  ensure(result != 0);
126 
127  // Exit:
128 
129  return result;
130 }
131 
132 
133 // ===========================================================
134 // NON-MEMBER FUNCTIONS
135 // ===========================================================
size_type ct() const
The number of items currently in use.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
Definition: scoped_index.h:672
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...
property_dof_function_type dof_function()
The function for computing the property dofs at given global coordinates.
put_property_dofs_fcn_action(sec_vd &xproperty, property_dof_function_type xfcn, bool xauto_access)
Creates an instance using property xproperty and dof function xfcn.
sec_vd & property()
The property section being acted on.
virtual void operator()(const scoped_index &xdisc_id, block< sec_vd_value_type > &xglobal_coords)
The push action.
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
void(* property_dof_function_type)(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
The type of the function for computing the property dofs at given global coordinates.
Definition: fields.h:64
A section of a fiber bundle with a d-dimensional vector space fiber.
Definition: sec_vd.h:54
An abstract discretization push action for field_vds::put_property_dofs.
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
Definition: sec_vd.cc:1144
double sec_vd_dof_type
The type of degree of freedom in the section space.
Definition: fiber_bundle.h:78
block< sec_vd_dof_type > _dofs
Buffer for property dofs.