SheafSystem  0.0.0.0
put_property_dofs_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_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_ACTION FACET
35 // ===========================================================
36 
37 // PUBLIC MEMBER FUNCTIONS
38 
40 put_property_dofs_action(sec_vd& xproperty, bool xauto_access)
41  : _property(xproperty)
42 {
43  // Preconditions:
44 
45  require(xauto_access || xproperty.state_is_read_accessible());
46 
47  // Body:
48 
49  if(xauto_access)
50  {
51  xproperty.get_read_access();
52  }
53 
54 
56 
57  int ldf = xproperty.schema().df();
58  _dofs.reserve(ldf);
59  _dofs.set_ct(ldf);
60 
61  if(xauto_access)
62  {
63  xproperty.release_access();
64  }
65 
66  // Postconditions:
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 
92 {
93  // Preconditions:
94 
95 
96  // Body:
97 
98  sec_vd& result = _property;
99 
100  // Postconditions:
101 
102 
103  // Exit:
104 
105  return result;
106 }
107 
108 // ===========================================================
109 // NON-MEMBER FUNCTIONS
110 // ===========================================================
put_property_dofs_action(sec_vd &xproperty, bool xauto_access)
Creates an instance using property xproperty.
sec_vd & _property
The property section being acted on.
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...
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
virtual void get_read_access() const
Get read access to the state associated with this.
sec_vd & property()
The property section being acted on.
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
void set_ct(size_type xct)
Sets ct() == xct.
A section of a fiber bundle with a d-dimensional vector space fiber.
Definition: sec_vd.h:54
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
int df() const
The dimension of the fiber space component.
block< sec_vd_dof_type > _dofs
Buffer for property dofs.