21 #include "SheafSystem/chart_point.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/chart_point_1d.h" 25 #include "SheafSystem/chart_point_2d.h" 26 #include "SheafSystem/chart_point_3d.h" 27 #include "SheafSystem/error_message.h" 28 #include "SheafSystem/std_algorithm.h" 29 #include "SheafSystem/std_iomanip.h" 30 #include "SheafSystem/std_sstream.h" 49 require((1 <= xdb) && (xdb < 4));
65 post_fatal_error_message(
"Invalid chart point dimension");
109 _chart_id = xchart_id;
113 ensure(chart_id() == xchart_id);
128 put_chart_id(xchart_id.
hub_pod());
132 ensure(chart_id() == xchart_id.
hub_pod());
154 ensure(result >= -1);
169 require((0 <= xi) && (xi < db()));
191 require((0 <= xi) && (xi < db()));
257 require(xvalues != 0);
258 require(xvalues_ub >= db());
264 put_local_coord(i, xvalues[i]);
288 put_local_coord(i, 0.0);
294 ensure_for_all(i, 0, db(), local_coord(i) == 0.0);
330 for(
int i=0; i<db(); ++i)
332 put_local_coord(i, 0.0);
411 invariance(unexecutable(
db() >= -1));
438 bool result =
dynamic_cast<const chart_point*
>(other) != 0;
459 int lother_db = xother.
db();
460 int lmin_db =
min(lthis_db, lother_db);
465 for(
int i=0; i<lmin_db; ++i)
467 lthis_coords[i] = lother_coords[i];
470 for(
int i=lmin_db; i<lthis_db; ++i)
472 lthis_coords[i] = 0.0;
497 bool result = (
db() == xother.
db());
501 for(
int i=0; result && (i<
db()); ++i)
558 for(
int i=0; i<xpt.
db(); i++)
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
chart_point_coord_type coord_type
The type of local coordinate; the scalar type for the local coordinate vector space.
void put_local_coords(const coord_type *xvalues, size_type xvalues_ub)
Sets the local coordinates to the values in xvalues.
static chart_point * new_chart_point(int xdb)
Factory method; creates a chart point with db() == xdb.
A point in a 3D chart space.
virtual int db() const =0
The dimension of this chart.
pod_index_type _chart_id
The id of the chart this point is in.
void put_chart_id(pod_index_type xchart)
Sets chart_id() to xchart_id.
pod_index_type chart_id() const
The id of the chart this point is in.
chart_point & operator=(const chart_point &xother)
Assignment operator.
chart_point()
Default constructor.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
bool is_valid() const
True if this ia a valid point in a chart.
Abstract base class with useful features for all objects.
void invalidate()
Makes this invalid.
virtual coord_type * local_coords()=0
The array of local coordinates.
void put_local_coords_zero()
Sets the local coordinates to the zero vector.
virtual bool invariant() const
Class invariant.
An index within the external ("client") scope of a given id space.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
void to_stream(std::ostream &xos=std::cout) const
Write instance information to an ostream (default = stdout).
SHEAF_DLL_SPEC void min(const vd &x0, vd_value_type &xresult, bool xauto_access)
Minimum component of x0, pre-allocated version.
A point in a 2D chart space.
bool invariant_check() const
True if invariant checking is enabled.
int_type pod_index_type
The plain old data index type.
std::string to_string() const
Get instance information as a string.
virtual void put_local_coord(int xi, coord_type xvalue)=0
Sets the xi-th local coordinate of this point to xvalue.
virtual ~chart_point()
Destructor.
A point in a 1D chart space.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
bool operator==(const chart_point &xother) const
Equality operator.
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
void enable_invariant_check() const
Enable invariant checking.
virtual coord_type local_coord(int xi) const =0
The xi-th local coordinate of this point.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
SHEAF_DLL_SPEC bool isunordered_or_equals(float x1, float x2)
True if isunordered(x1, x2) or x1 == x2.