21 #ifndef FIELD_FACTORY_2_IMPL_H 22 #define FIELD_FACTORY_2_IMPL_H 24 #ifndef SHEAF_DLL_SPEC_H 25 #include "SheafSystem/sheaf_dll_spec.h" 28 #ifndef FIELD_FACTORY_2_H 29 #include "SheafSystem/field_factory_2.h" 32 #ifndef ASSERT_CONTRACT_H 33 #include "SheafSystem/assert_contract.h" 36 #ifndef BASE_SPACE_MEMBER_H 37 #include "SheafSystem/base_space_member.h" 40 #ifndef ERROR_MESSAGE_H 41 #include "SheafSystem/error_message.h" 44 #ifndef FIBER_BUNDLES_NAMESPACE_H 45 #include "SheafSystem/fiber_bundles_namespace.h" 48 #ifndef POINT_BLOCK_1D_H 49 #include "SheafSystem/point_block_1d.h" 52 #ifndef POINT_BLOCK_2D_H 53 #include "SheafSystem/point_block_2d.h" 56 #ifndef POINT_BLOCK_3D_H 57 #include "SheafSystem/point_block_3d.h" 60 #ifndef SEC_E1_UNIFORM_H 61 #include "SheafSystem/sec_e1_uniform.h" 64 #ifndef SEC_E2_UNIFORM_H 65 #include "SheafSystem/sec_e2_uniform.h" 68 #ifndef SEC_E3_UNIFORM_H 69 #include "SheafSystem/sec_e3_uniform.h" 72 #ifndef SECTION_TRAITS_H 73 #include "SheafSystem/section_traits.h" 76 #ifndef STRUCTURED_BLOCK_1D_H 77 #include "SheafSystem/structured_block_1d.h" 80 #ifndef STRUCTURED_BLOCK_2D_H 81 #include "SheafSystem/structured_block_2d.h" 84 #ifndef STRUCTURED_BLOCK_3D_H 85 #include "SheafSystem/structured_block_3d.h" 88 #ifndef UNSTRUCTURED_BLOCK_H 89 #include "SheafSystem/unstructured_block.h" 92 #include "SheafSystem/sec_e1.h" 93 #include "SheafSystem/sec_e2.h" 94 #include "SheafSystem/sec_e3.h" 96 #include "SheafSystem/sec_at0.h" 97 #include "SheafSystem/sec_at0_space.h" 98 #include "SheafSystem/sec_at1_space.h" 99 #include "SheafSystem/section_space_schema_poset.h" 111 void put_dofs(
sec_e1* xsec,
118 require(xi_size > 0);
119 require(xlb.
ct() >= 1);
120 require(xub.
ct() >= 1);
128 for(
int i=0; i<i_ct; ++i)
130 lfiber[0] = xlb[0] + i*ldelx;
145 void put_dofs(
sec_e2* xsec,
153 require(xi_size > 0);
154 require(xj_size > 0);
155 require(xlb.
ct() >= 2);
156 require(xub.
ct() >= 2);
169 for(
int i=0; i<i_ct; ++i)
171 lfiber[0] = xlb[0] + i*ldelx;
172 for(
int j=0; j<j_ct; ++j)
175 lfiber[1] = xlb[1] + j*ldely;
191 void put_dofs(
sec_e3* xsec,
200 require(xi_size > 0);
201 require(xj_size > 0);
202 require(xlb.
ct() >= 3);
203 require(xub.
ct() >= 3);
220 for(
int i=0; i<i_ct; ++i)
222 lfiber[0] = xlb[0] + i*ldelx;
223 for(
int j=0; j<j_ct; ++j)
225 lfiber[1] = xlb[1] + j*ldely;
226 for(
int k=0; k<k_ct; ++k)
228 lfiber[2] = xlb[2] + k*ldelz;
229 ldisc_id = (i*j_ct+j)*k_ct + k;
264 if(lbase_host.
is_jim(lbase_id,
false))
271 if((xsec->
schema().
df() == 1) && (xlb.
ct() == 1) && (xub.
ct() == 1))
275 string lbase_type_name(lbase_host.
type_name(lbase_id));
276 if((lbase_type_name ==
"structured_block_1d"))
284 put_dofs(xsec, lbase.i_size()+1, xlb, xub);
285 lbase.detach_from_state();
287 else if((lbase_type_name ==
"point_block_1d"))
294 put_dofs(xsec, lbase.i_size(), xlb, xub);
295 lbase.detach_from_state();
322 if((xlb.
ct() == 1) && (xub.
ct() == 1))
350 if(lbase_host.
is_jim(lbase_id,
false))
357 if((xsec->
schema().
df() == 2) && (xlb.
ct() == 2) && (xub.
ct() == 2))
361 string lbase_type_name(lbase_host.
type_name(lbase_id));
362 if(lbase_type_name ==
"structured_block_2d")
370 put_dofs(xsec, lbase.i_size()+1, lbase.j_size()+1, xlb, xub);
371 lbase.detach_from_state();
373 else if(lbase_type_name ==
"point_block_2d")
380 put_dofs(xsec, lbase.i_size(), lbase.j_size(), xlb, xub);
381 lbase.detach_from_state();
408 if((xlb.
ct() == 2) && (xub.
ct() == 2))
436 if(lbase_host.
is_jim(lbase_id,
false))
441 if((xsec->
schema().
df() == 3) && (xlb.
ct() == 3) && (xub.
ct() == 3))
445 string lbase_type_name(lbase_host.
type_name(lbase_id));
446 if(lbase_type_name ==
"structured_block_3d")
454 put_dofs(xsec, lbase.i_size()+1, lbase.j_size()+1, lbase.k_size()+1, xlb, xub);
455 lbase.detach_from_state();
457 else if(lbase_type_name ==
"point_block_3d")
464 put_dofs(xsec, lbase.i_size(), lbase.j_size(), lbase.k_size(), xlb, xub);
465 lbase.detach_from_state();
492 if((xlb.
ct() == 3) && (xub.
ct() == 3))
507 template <
typename base_type>
518 require(xbase_path.
full());
524 xresult.attach_to_state(&xns, xbase_path);
552 require(xbase_path.
full());
574 xresult.
new_state(lhost, xbase_index_ubs[0],
true);
602 require(xbase_path.
full());
624 xresult.
new_state(lhost, xbase_index_ubs[0], xbase_index_ubs[1],
true);
654 require(xbase_path.
full());
708 require(xbase_path.
full());
730 xresult.
new_state(lhost, xbase_index_ubs[0],
true);
758 require(xbase_path.
full());
780 xresult.
new_state(lhost, xbase_index_ubs[0], xbase_index_ubs[1],
true);
808 require(xbase_path.
full());
863 require(xbase_path.
full());
865 ((1 <= xbase_index_ubs.
ct()) && (xbase_index_ubs.
ct() <= 3)));
877 int ldb = xbase_index_ubs.
ct();
897 for(
int i=0; i< xbase_index_ubs.
ct(); ++i)
899 lpt_ct *= xbase_index_ubs.
ct();
901 xresult.
new_state(lhost, xlocal_cell_prototype_path, lpt_ct,
true);
905 if(xlocal_cell_prototype_path.
empty())
912 xlocal_cell_prototype_path,
917 if(xlocal_cell_prototype_path.
empty())
923 xlocal_cell_prototype_path,
929 if(xlocal_cell_prototype_path.
empty())
935 xlocal_cell_prototype_path,
942 post_fatal_error_message(
"Unsupported base dimension");
965 template <
typename coord_type,
typename prop_type,
typename base_type>
982 template <
typename coord_type,
typename prop_type,
typename base_type>
1001 template <
typename coord_type,
typename prop_type,
typename base_type>
1016 require(xbase_path.
full());
1017 require(unexecutable(
"base exists or index_ubs compatible with base_type"));
1019 require(xcoord_path.
full());
1022 require(xprop_path.
full());
1027 using namespace std;
1036 poset_path llocal_cell_prototype_path(_local_cell_prototype_path);
1044 llocal_cell_prototype_path,
1046 lbase.detach_from_state();
1054 llocal_cell_prototype_path,
1056 lbase.detach_from_state();
1061 typename coord_type::host_type& lcoords_host =
1062 xns.
member_poset<
typename coord_type::host_type>(xcoord_path,
false);
1066 string lcoord_name(xcoord_path.member_name());
1069 if(lcoords_host.contains_member(lcoord_name))
1072 lcoords.attach_to_state(&lcoords_host, lcoord_name);
1073 lcoords_host.release_access();
1077 lcoords.new_jim_state(&lcoords_host);
1078 lcoords.put_name(lcoord_name,
true,
true);
1079 put_bounds(&lcoords, _base_index_ubs, _coord_lb, _coord_ub);
1084 typename prop_type::host_type& lprop_host =
1085 xns.
member_poset<
typename prop_type::host_type>(xprop_path,
false);
1089 string lprop_name(xprop_path.member_name());
1092 if(lprop_host.contains_member(lprop_name))
1095 lprop.attach_to_state(&lprop_host, lprop_name);
1096 lprop_host.release_access();
1100 lprop.new_jim_state(&lprop_host);
1101 lprop.put_name(lprop_name,
true,
true);
1110 lcoords.detach_from_state();
1111 lprop.detach_from_state();
1120 ensure(result->base_space().path(
true) == xbase_path);
1121 ensure(result->coordinates().path(
true) == xcoord_path);
1122 ensure(result->property().path(
true) == xprop_path);
1129 template <
typename coord_type,
typename prop_type,
typename base_type>
1134 const std::string& xcoord_name,
1135 const std::string& xprop_name,
1144 require(xbase_path.
full());
1145 require(unexecutable(
"base exists or index_ubs compatible with base_type"));
1150 require(coord_rep_path().empty() || coord_rep_path().full());
1154 require(coord_type::fiber_type::template standard_host_is_available<typename coord_type::fiber_type>(xns, coord_fiber_suffix(), xauto_access));
1157 require(coord_type::template standard_host_is_available<coord_type>(xns, xbase_path, coord_rep_path(), coord_section_suffix(), coord_fiber_suffix(), xauto_access));
1159 require(prop_rep_path().empty() || prop_rep_path().full());
1163 require(prop_type::fiber_type::template standard_host_is_available<typename prop_type::fiber_type>(xns, prop_fiber_suffix(), xauto_access));
1166 require(prop_type::template standard_host_is_available<prop_type>(xns, xbase_path, prop_rep_path(), prop_section_suffix(), prop_fiber_suffix(), xauto_access));
1177 poset_path llocal_cell_prototype_path(_local_cell_prototype_path);
1185 llocal_cell_prototype_path,
1187 lbase.detach_from_state();
1195 llocal_cell_prototype_path,
1197 lbase.detach_from_state();
1202 typename coord_type::host_type& lcoords_host =
1203 coord_type::standard_host(xns,
1206 coord_section_suffix(),
1207 coord_fiber_suffix(),
1213 if(lcoords_host.contains_member(xcoord_name))
1215 lcoords_host.get_read_access();
1216 lcoords.attach_to_state(&lcoords_host, xcoord_name);
1217 lcoords_host.release_access();
1221 lcoords.new_jim_state(&lcoords_host);
1222 lcoords.put_name(xcoord_name,
true,
true);
1223 put_bounds(&lcoords, _base_index_ubs, _coord_lb, _coord_ub);
1228 typename prop_type::host_type& lprop_host =
1229 prop_type::standard_host(xns,
1232 prop_section_suffix(),
1233 prop_fiber_suffix(),
1239 if(lprop_host.contains_member(xprop_name))
1241 lprop_host.get_read_access();
1242 lprop.attach_to_state(&lprop_host, xprop_name);
1243 lprop_host.release_access();
1247 lprop.new_jim_state(&lprop_host);
1248 lprop.put_name(xprop_name,
true,
true);
1257 lcoords.detach_from_state();
1258 lprop.detach_from_state();
1267 ensure(result->base_space().path(
true) == xbase_path);
1269 ensure(result->coordinates().path(
true).poset_name() ==
1270 coord_type::template standard_host_path<coord_type>(xbase_path, coord_rep_path(), coord_section_suffix(), coord_fiber_suffix()).poset_name());
1271 ensure(result->coordinates().path(
true).member_name() == xcoord_name);
1273 ensure(result->property().path(
true).poset_name() ==
1274 prop_type::template standard_host_path<prop_type>(xbase_path, prop_rep_path(), prop_section_suffix(), prop_fiber_suffix()).poset_name());
1275 ensure(result->property().path(
true).member_name() == xprop_name);
1288 template <
typename coord_type,
typename prop_type,
typename base_type>
1293 return _base_schema_path;
1296 template <
typename coord_type,
typename prop_type,
typename base_type>
1301 return _base_index_ubs;
1304 template <
typename coord_type,
typename prop_type,
typename base_type>
1309 return _local_cell_prototype_path;
1320 template <
typename coord_type,
typename prop_type,
typename base_type>
1325 return _coord_rep_path;
1328 template <
typename coord_type,
typename prop_type,
typename base_type>
1333 return _coord_fiber_suffix;
1336 template <
typename coord_type,
typename prop_type,
typename base_type>
1341 return _coord_section_suffix;
1344 template <
typename coord_type,
typename prop_type,
typename base_type>
1352 template <
typename coord_type,
typename prop_type,
typename base_type>
1367 template <
typename coord_type,
typename prop_type,
typename base_type>
1372 return _prop_rep_path;
1375 template <
typename coord_type,
typename prop_type,
typename base_type>
1380 return _prop_fiber_suffix;
1383 template <
typename coord_type,
typename prop_type,
typename base_type>
1388 return _prop_section_suffix;
1391 template <
typename coord_type,
typename prop_type,
typename base_type>
1399 template <
typename coord_type,
typename prop_type,
typename base_type>
1415 #endif // FIELD_FACTORY_2_IMPL_H
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
void new_state(const size_type &xi_size, const size_type &xj_size, bool xauto_access=true)
Creates a new point_block_2d state in host() with i_size() == xi_size and j_size() == xj_size and att...
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
bool full() const
True if both poset name and member name are not empty.
size_type ct() const
The number of items currently in use.
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
A homogeneous collection of connected quads arranged in an i_size() x j_size() array.
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
std::string type_name(pod_index_type xmbr_hub_id) const
The type id of the member with hub id xmbr_hub_id.
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...
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
void make_base_space(fiber_bundles_namespace &xns, const poset_path &xbase_path, const wsv_block< int > &xbase_index_ubs, poset_path &xlocal_cell_prototype_path, unstructured_block &xresult)
Finds or creates the base space specified by xbase_path; specialization for unstructured_block.
A general antisymmetric tensor of degree 1 over an abstract vector space (volatile version)...
bool contains_poset_member(pod_index_type xposet_hub_id, pod_index_type xmember_hub_id, bool xauto_access=true) const
True if this contains a poset with hub id xposet_hub_id which contains a member with hub id xmember_h...
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
void new_state(const size_type &xi_size, const size_type &xj_size, const size_type &xk_size, bool xauto_access=true)
Creates a new homogeneous_block_1d state in host() with i_size() == xi_size, j_size() == xj_size...
poset_state_handle & member_poset(pod_index_type xhub_id, bool xauto_access=true) const
The poset_state_handle object referred to by hub id xhub_id.
OBSOLETE: use zone_nodes_block or point_block_*d. A client handle for a base space member which repre...
The poset for sec_rep_descriptors.
static const std::string & prototypes_poset_name()
The name of the prototypes poset.
field_traits< prop_type >::field_type field_type
Typedef: The type of the field to create.
A homogeneous collection of connected segments arranged in an i_size() array.
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, int xmax_db, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
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...
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
Features describing a section type. Declaration only; there is no generic implementation for this tem...
bool state_is_read_write_accessible() const
True if this is attached and if the state is accessible for read and write or access control is disab...
void put_member_name(const std::string &xname)
Sets member_name() to xname.
A homogeneous collection of i_size() * j_size() disconnected points similar to a structured_block_2d...
void new_state(const size_type &xi_size, const size_type &xj_size, const size_type &xk_size, bool xauto_access=true)
Creates a new structured_block_1d state in host() with i_size() == xi_size, j_size() == xj_size...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
std::string poset_name() const
The poset name part of the path.
virtual void put_name(const std::string &xname, bool xunique, bool xauto_access)
Make xname a name for this; if xunique, make xname the only name.
bool empty() const
True if both poset name and member name are empty.
void put_poset_name(const std::string &xname)
Sets poset_name() to xname.
A section of a fiber bundle with a 3-dimensional Euclidean vector space fiber.
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
A homogeneous collection of connected hexahedra arranged in an i_size() x j_size() x k_size() array...
bool path_is_auto_read_write_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read-write accessible.
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
int_type pod_index_type
The plain old data index type.
A section of a fiber bundle with a 1-dimensional Euclidean vector space fiber.
std::string member_name() const
The member name part of the path.
Features describing a field type. Declaration only; there is no generic implementation for this templ...
virtual bool is_jim(pod_index_type xmbr_hub_id, bool xin_current_version=true) const
True if the member with hub id xmbr_hub_id is a jim in the current version (xin_current_version == tr...
virtual void new_state(poset *xhost, const std::string &xlocal_cell_prototype_name, bool xauto_access)
Creates a new unrefined (jim) unstructured block state in xhost and attaches this to it...
A homogeneous collection of i_size() disconnected points; similar to a structured_block_1d, but without the segments.
int df() const
The dimension of the fiber space component.
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
static bool is_valid_name(const std::string &xname)
True if xname is not empty and contains only name legal characters.
virtual void get_read_access() const
Get read access to the state associated with this.
std::string path() const
The full path as a string.
double sec_vd_dof_type
The type of degree of freedom in the section space.
void new_state(const size_type &xi_size, const size_type &xj_size, bool xauto_access=true)
Creates a new structured_block_2d state in host() with i_size() == xi_size and j_size() == xj_size an...
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
Namespace for the fiber_bundles component of the sheaf system.
A homogeneous collection of i_size()*j_size()*k_size() disconnected points similar to a structured_bl...
void new_state(const size_type &xi_size, bool xauto_access=true)
Creates a new point_block_1d state in host() with i_size() == xi_size and attaches this to it...
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 new_state(const size_type &xi_size, bool xauto_access=true)
Creates a new structured_block_1d state in host() with i_size() == xi_size and attaches this to it...
base_space_poset & base_space()
The base space for section spaces on this schema.
A section of a fiber bundle with a 2-dimensional Euclidean vector space fiber.
A factory for making field_vd objects with coordinates section of type coord_type, property section of type prop_type and base space of type base_type.
pod_index_type base_space_id() const
The member id of the base space component of this.