SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Store information about solid models. More...
#include <Resource.h>
Public Types | |
typedef UUIDsToEntities | storage_type |
typedef storage_type::iterator | iter_type |
typedef UUIDsToTessellations::iterator | tess_iter_type |
typedef smtk::geometry::Resource | ParentResource |
![]() | |
typedef smtk::geometry::Resource | ParentResource |
![]() | |
typedef smtk::resource::Resource | ParentResource |
![]() | |
typedef std::size_t | Index |
typedef smtk::resource::Metadata | Metadata |
typedef detail::ResourceLinks | Links |
typedef detail::ResourceProperties | Properties |
typedef query::Queries | Queries |
Public Member Functions | |
smtkTypeMacro (smtk::model::Resource) | |
smtkSharedPtrCreateMacro (smtk::resource::PersistentObject) | |
Resource (Resource &&rhs)=default | |
const UUIDsToEntities & | topology () const |
const UUIDsToTessellations & | tessellations () const |
const UUIDsToTessellations & | analysisMesh () const |
smtk::common::UUID | modelOwningEntity (const smtk::common::UUID &uid) const |
Attempt to find a model owning the given entity. | |
smtk::common::UUID | sessionOwningEntity (const smtk::common::UUID &uid) const |
Attempt to find a session owning the given entity. | |
void | assignDefaultNames () |
Assign a string property named "name" to every entity without one. More... | |
void | assignDefaultNamesToModelChildren (const smtk::common::UUID &modelId) |
Assign a string property named "name" to every entity of a model without one. More... | |
std::string | assignDefaultName (const smtk::common::UUID &uid) |
Assign a string property named "name" to the given entity. More... | |
std::string | assignDefaultNameIfMissing (const smtk::common::UUID &uid) |
Assign a string property named "name" to the given entity. More... | |
SessionRef | registerSession (SessionPtr session) |
Mark the start of a modeling session by registering the session with SMTK backing storage. | |
bool | unregisterSession (SessionPtr session, bool expungeSession=true) |
Mark the end of a modeling session by removing its session. More... | |
SessionPtr | sessionData (const smtk::model::SessionRef &sessRef) const |
Find a session given its session UUID (or nullptr). | |
template<typename Collection , typename Type > | |
Collection | findEntitiesByTypeAndPropertyAs (const std::string &pname, const Type &pval) |
template<typename Collection , typename Type > | |
Collection | findEntitiesByTypeAndPropertyAs (const std::string &pname, const std::vector< Type > &pval) |
template<typename Collection > | |
Collection | entitiesMatchingFlagsAs (BitFlags flags, bool exactMatch=true) |
template<typename T > | |
bool | insertModelFaceWithOrientedOuterLoop (const smtk::common::UUID &faceId, const smtk::common::UUID &faceUseId, const smtk::common::UUID &loopId, const T &orderedEdgesWithOrientation) |
template<typename T > | |
bool | insertModelFaceOrientedInnerLoop (const smtk::common::UUID &loopId, const smtk::common::UUID &preExistingLoopId, const T &orderedEdgesWithOrientation) |
template<typename T , typename U , typename V > | |
bool | deleteEntities (T &entities, U &modified, V &expunged, bool debugLog) |
smtk::io::Logger & | log () |
Constructors and destructors. | |
Model resource instances should always be created using the static create() method. | |
Resource (smtk::resource::ManagerPtr=smtk::resource::ManagerPtr()) | |
Create a default, empty model resource. | |
Resource (const smtk::common::UUID &uid, smtk::resource::ManagerPtr=smtk::resource::ManagerPtr()) | |
Create a default, empty model resource. | |
Resource (shared_ptr< UUIDsToEntities > topology, shared_ptr< UUIDsToTessellations > tess, shared_ptr< UUIDsToTessellations > analysismesh, shared_ptr< UUIDsToAttributeAssignments > attribs, const smtk::common::UUID &uid, smtk::resource::ManagerPtr=smtk::resource::ManagerPtr()) | |
Create a model resource using the given storage instances. | |
~Resource () override | |
Destroying a model resource requires us to release the default attribute resource.. | |
Direct member access. | |
These methods provide direct access to the class's storage. | |
UUIDsToEntities & | topology () |
Remove all entities and properties from this object. Does not change id or emit signals. | |
UUIDsToTessellations & | tessellations () |
Remove all entities and properties from this object. Does not change id or emit signals. | |
UUIDsToTessellations & | analysisMesh () |
Remove all entities and properties from this object. Does not change id or emit signals. | |
bool | setMeshTessellations (const smtk::mesh::ResourcePtr &) |
Remove all entities and properties from this object. Does not change id or emit signals. | |
smtk::mesh::ResourcePtr | meshTessellations () const |
Remove all entities and properties from this object. Does not change id or emit signals. | |
void | clear () |
Remove all entities and properties from this object. Does not change id or emit signals. | |
const UUIDsToAttributeAssignments & | attributeAssignments () const |
Remove all entities and properties from this object. Does not change id or emit signals. | |
BitFlags | type (const smtk::common::UUID &ofEntity) const |
Queries on entities belonging to the solid. More... | |
int | dimension (const smtk::common::UUID &ofEntity) const |
Return the dimension of the manifold that the passed entity represents. | |
std::string | name (const smtk::common::UUID &ofEntity) const |
Return a name for the given entity ID. More... | |
EntityPtr | findEntity (const smtk::common::UUID &uid, bool trySessions=true) const |
Return the smtk::model::Entity associated with uid (or nullptr). More... | |
smtk::resource::ComponentPtr | find (const smtk::common::UUID &uid) const override |
Remove all entities and properties from this object. Does not change id or emit signals. | |
std::function< bool(const smtk::resource::Component &)> | queryOperation (const std::string &) const override |
Given a query string, return a functor that determines if a component is accepted by the query. | |
void | visit (smtk::resource::Component::Visitor &) const override |
Remove all entities and properties from this object. Does not change id or emit signals. | |
virtual SessionInfoBits | erase (const smtk::common::UUID &uid, SessionInfoBits flags=smtk::model::SESSION_EVERYTHING) |
Remove the entity with the given uid. More... | |
virtual SessionInfoBits | erase (const EntityRef &entityref, SessionInfoBits flags=smtk::model::SESSION_EVERYTHING) |
A convenience method for erasing an entity from storage. | |
virtual SessionInfoBits | erase (const EntityPtr &entityrec, SessionInfoBits flags=smtk::model::SESSION_EVERYTHING) |
A convenience method for erasing an entity from storage. | |
virtual SessionInfoBits | eraseModel (const Model &entityref, SessionInfoBits flags=smtk::model::SESSION_EVERYTHING) |
A convenience method for erasing a model and its children. More... | |
SessionInfoBits | hardErase (const EntityRef &eref, SessionInfoBits flags=smtk::model::SESSION_EVERYTHING) |
Erase records related to the entity with no clean or safety checks. More... | |
smtk::common::UUIDs | bordantEntities (const smtk::common::UUID &ofEntity, int ofDimension=-2) const |
Return the (Dimension+1 or higher)-entities that are the immediate bordants of the passed entity. More... | |
smtk::common::UUIDs | bordantEntities (const smtk::common::UUIDs &ofEntities, int ofDimension=-2) const |
Return the (Dimension+1 or higher)-entities that are the immediate bordants of any of the passed entities. More... | |
smtk::common::UUIDs | boundaryEntities (const smtk::common::UUID &ofEntity, int ofDimension=-2) const |
Return the (Dimension-1 or lower)-entities that are the immediate boundary of the passed entity. More... | |
smtk::common::UUIDs | boundaryEntities (const smtk::common::UUIDs &ofEntities, int ofDimension=-2) const |
Return the (Dimension-1 or lower)-entities that are the immediate boundary of any of the passed entities. More... | |
smtk::common::UUIDs | lowerDimensionalBoundaries (const smtk::common::UUID &ofEntity, int lowerDimension) |
Return lower-dimensional boundaries of the passed d-dimensional entity. More... | |
smtk::common::UUIDs | higherDimensionalBordants (const smtk::common::UUID &ofEntity, int higherDimension) |
Return higher-dimensional bordants of the passed d-dimensional entity. More... | |
smtk::common::UUIDs | adjacentEntities (const smtk::common::UUID &ofEntity, int ofDimension) |
Return entities of the requested dimension that share a boundary relationship with the passed entity. | |
smtk::common::UUIDs | entitiesMatchingFlags (BitFlags mask, bool exactMatch=true) |
Return all entities of the requested dimension that are present in the solid. | |
smtk::common::UUIDs | entitiesOfDimension (int dim) |
Return all entities of the requested dimension that are present in the solid. | |
smtk::common::UUID | unusedUUID () |
Entity construction. More... | |
iter_type | insertEntityOfTypeAndDimension (BitFlags entityFlags, int dim) |
Insert a new cell of the specified dimension, returning an iterator with a new, unique UUID. | |
iter_type | insertEntity (EntityPtr cell) |
Insert the specified cell, returning an iterator. More... | |
iter_type | setEntityOfTypeAndDimension (const smtk::common::UUID &uid, BitFlags entityFlags, int dim) |
Create and map a new cell of the given dimension to the given uid. More... | |
iter_type | setEntity (EntityPtr cell) |
Map the specified cell c to the given uid. More... | |
smtk::common::UUID | addEntityOfTypeAndDimension (BitFlags entityFlags, int dim) |
A wrappable version of InsertEntityOfTypeAndDimension. | |
smtk::common::UUID | addEntity (EntityPtr cell) |
A wrappable version of InsertEntity. | |
smtk::common::UUID | addEntityOfTypeAndDimensionWithUUID (const smtk::common::UUID &uid, BitFlags entityFlags, int dim) |
A wrappable version of SetEntityOfTypeAndDimension. | |
smtk::common::UUID | addEntityWithUUID (const smtk::common::UUID &uid, EntityPtr cell) |
A wrappable version of setEntity. This will override the UUID in cell. | |
iter_type | insertCellOfDimension (int dim) |
Shortcuts for inserting cells with default entity flags. | |
iter_type | setCellOfDimension (const smtk::common::UUID &uid, int dim) |
Remove all entities and properties from this object. Does not change id or emit signals. | |
smtk::common::UUID | addCellOfDimension (int dim) |
Remove all entities and properties from this object. Does not change id or emit signals. | |
smtk::common::UUID | addCellOfDimensionWithUUID (const smtk::common::UUID &uid, int dim) |
Remove all entities and properties from this object. Does not change id or emit signals. | |
void | insertEntityReferences (const UUIDWithEntityPtr &c) |
Given an entity c, ensure that all of its references contain a reference to it. | |
bool | elideOneEntityReference (const UUIDWithEntityPtr &c, const smtk::common::UUID &r) |
Given an entity c and the ID of one of its related entities r, overwrite the occurrence of r in c's array of relations with an invalid UUID. More... | |
void | elideEntityReferences (const UUIDWithEntityPtr &c) |
Given an entity c, ensure that all of its references contain no reference to it. More... | |
void | removeEntityReferences (const UUIDWithEntityPtr &c) |
Given an entity c, ensure that all of its references contain no reference to it. | |
virtual void | addToGroup (const smtk::common::UUID &groupId, const smtk::common::UUIDs &uids) |
Add entities (specified by their uids) to the given group (groupId). More... | |
Model property accessors. | |
void | setFloatProperty (const smtk::common::UUID &entity, const std::string &propName, smtk::model::Float propValue) |
void | setFloatProperty (const smtk::common::UUID &entity, const std::string &propName, const smtk::model::FloatList &propValue) |
smtk::model::FloatList const & | floatProperty (const smtk::common::UUID &entity, const std::string &propName) const |
smtk::model::FloatList & | floatProperty (const smtk::common::UUID &entity, const std::string &propName) |
bool | hasFloatProperty (const smtk::common::UUID &entity, const std::string &propName) const |
bool | removeFloatProperty (const smtk::common::UUID &entity, const std::string &propName) |
void | setStringProperty (const smtk::common::UUID &entity, const std::string &propName, const smtk::model::String &propValue) |
void | setStringProperty (const smtk::common::UUID &entity, const std::string &propName, const smtk::model::StringList &propValue) |
smtk::model::StringList const & | stringProperty (const smtk::common::UUID &entity, const std::string &propName) const |
smtk::model::StringList & | stringProperty (const smtk::common::UUID &entity, const std::string &propName) |
bool | hasStringProperty (const smtk::common::UUID &entity, const std::string &propName) const |
bool | removeStringProperty (const smtk::common::UUID &entity, const std::string &propName) |
void | setIntegerProperty (const smtk::common::UUID &entity, const std::string &propName, smtk::model::Integer propValue) |
void | setIntegerProperty (const smtk::common::UUID &entity, const std::string &propName, const smtk::model::IntegerList &propValue) |
smtk::model::IntegerList const & | integerProperty (const smtk::common::UUID &entity, const std::string &propName) const |
smtk::model::IntegerList & | integerProperty (const smtk::common::UUID &entity, const std::string &propName) |
bool | hasIntegerProperty (const smtk::common::UUID &entity, const std::string &propName) const |
bool | removeIntegerProperty (const smtk::common::UUID &entity, const std::string &propName) |
Unbacked entity insertion methods | |
Methods to insert entities into the local storage independent of a session. The methods that start with "add" will generate a UUID for you and return a entityref to the new entity. Methods that start with "insert" accept a UUID and will return a entityref to the new entity (or the existing entity if it matches the entity type being created). If you specify a UUID in use by an entity of a different type, an invalid entityref will be returned. Finally, methods that start with "set" will either modify an existing entity or create a new one as required. The "set" methods are used to modify arrangements that may have been created as part of constructing other entities (e.g., calling addFace() creates arrangements for 2 face-uses; you can then use setFaceUse to replace any existing use records with the one you specify). | |
bool | closeSession (const SessionRef &sess) |
Unregister a session from the model resource. | |
SessionRefs | sessions () const |
Return an array of all the sessions this resource owns. | |
Vertex | insertVertex (const smtk::common::UUID &uid) |
Add a vertex to the resource (without any relationships) at the given uid. | |
Edge | insertEdge (const smtk::common::UUID &uid) |
Add an edge to the resource (without any relationships) at the given uid. | |
Face | insertFace (const smtk::common::UUID &uid) |
Add a face to the resource (without any relationships) at the given uid. | |
Volume | insertVolume (const smtk::common::UUID &uid) |
Add a volume to the resource (without any relationships) at the given uid. | |
Vertex | addVertex () |
Add an edge to the resource (without any relationships) | |
Edge | addEdge () |
Add an edge to the resource (without any relationships) | |
Face | addFace () |
Add a face to the resource (without any relationships) More... | |
Volume | addVolume () |
Add a volume to the resource (without any relationships) | |
VertexUse | insertVertexUse (const smtk::common::UUID &uid) |
Insert a VertexUse at the specified uid. | |
VertexUse | setVertexUse (const smtk::common::UUID &uid, const Vertex &src, int sense) |
Create a VertexUse with the specified uid and replace src's VertexUse. | |
EdgeUse | insertEdgeUse (const smtk::common::UUID &uid) |
Insert a EdgeUse at the specified uid. | |
EdgeUse | setEdgeUse (const smtk::common::UUID &uid, const Edge &src, int sense, Orientation o) |
Create a EdgeUse with the specified uid and replace src's EdgeUse. | |
FaceUse | insertFaceUse (const smtk::common::UUID &uid) |
Insert a FaceUse at the specified uid. | |
FaceUse | setFaceUse (const smtk::common::UUID &uid, const Face &src, int sense, Orientation o) |
Create a FaceUse with the specified uid and replace src's FaceUse. | |
VolumeUse | insertVolumeUse (const smtk::common::UUID &uid) |
Insert a VolumeUse at the specified uid. | |
VolumeUse | setVolumeUse (const smtk::common::UUID &uid, const Volume &src) |
Create a VolumeUse with the specified uid and replace src's VolumeUse. | |
VertexUse | addVertexUse () |
Add a vertex-use to the resource (without any relationships) | |
VertexUse | addVertexUse (const Vertex &src, int sense) |
Find or add a vertex-use to the resource with a relationship back to a vertex. | |
EdgeUse | addEdgeUse () |
Add an edge-use to the resource (without any relationships) | |
EdgeUse | addEdgeUse (const Edge &src, int sense, Orientation o) |
Find or add a edge-use to the resource with a relationship back to a edge. | |
FaceUse | addFaceUse () |
Add a face-use to the resource (without any relationships) | |
FaceUse | addFaceUse (const Face &src, int sense, Orientation o) |
Find or add a face-use to the resource with a relationship back to a face. | |
VolumeUse | addVolumeUse () |
Add a volume-use to the resource (without any relationships) | |
VolumeUse | addVolumeUse (const Volume &src) |
Find or add a volume-use to the resource with a relationship back to a volume. | |
Chain | insertChain (const smtk::common::UUID &uid) |
Insert a Chain at the specified uid. | |
Chain | setChain (const smtk::common::UUID &uid, const EdgeUse &use) |
Find or add a chain to the resource with a relationship back to its owning edge-use. | |
Chain | setChain (const smtk::common::UUID &uid, const Chain &parent) |
Find or add a chain to the resource with a relationship back to its owning chain. | |
Loop | insertLoop (const smtk::common::UUID &uid) |
Insert a Loop at the specified uid. | |
Loop | setLoop (const smtk::common::UUID &uid, const FaceUse &use) |
Find or add a chain to the resource with a relationship back to its owning face-use. | |
Loop | setLoop (const smtk::common::UUID &uid, const Loop &parent) |
Find or add a chain to the resource with a relationship back to its owning loop. | |
Shell | insertShell (const smtk::common::UUID &uid) |
Insert a Shell at the specified uid. | |
Shell | setShell (const smtk::common::UUID &uid, const VolumeUse &use) |
Find or add a chain to the resource with a relationship back to its owning volume-use. | |
Shell | setShell (const smtk::common::UUID &uid, const Shell &parent) |
Find or add a chain to the resource with a relationship back to its owning shell. | |
Chain | addChain () |
Add a 0/1-d shell (a vertex chain) to the resource (without any relationships) | |
Chain | addChain (const EdgeUse &) |
Add a 0/1-d shell (a vertex chain) to the resource with a relation to its edge use. | |
Chain | addChain (const Chain &) |
Add a 0/1-d shell (a vertex chain) to the resource with a relation to its edge use. | |
Loop | addLoop () |
Add a 1/2-d shell (an edge loop) to the resource (without any relationships) | |
Loop | addLoop (const FaceUse &) |
Add a 1/2-d shell (an edge loop) to the resource with a relation to its parent face use. | |
Loop | addLoop (const Loop &) |
Add a 1/2-d shell (an edge loop) to the resource with a relation to its parent loop. | |
Shell | addShell () |
Add a 2/3-d shell (a face-shell) to the resource (without any relationships) | |
Shell | addShell (const Volume &src) |
A convenience method to find or create a volume use for the volume plus a shell. | |
Shell | addShell (const VolumeUse &src) |
Add a 2/3-d shell (an face shell) to the resource with a relation to its volume. | |
Group | insertGroup (const smtk::common::UUID &uid, int extraFlags=0, const std::string &name=std::string()) |
Add an entity group to the resource (without any relationships). More... | |
Group | addGroup (int extraFlags=0, const std::string &name=std::string()) |
Add a group, creating a new UUID in the process. More... | |
AuxiliaryGeometry | insertAuxiliaryGeometry (const smtk::common::UUID &uid, int dim=-1) |
Add auxiliary geometry (of the given dim, which may be -1) to the resource with the specified uid. | |
AuxiliaryGeometry | addAuxiliaryGeometry (int dim=-1) |
Add auxiliary geometry (of the given dim, which may be -1) to the resource. | |
AuxiliaryGeometry | addAuxiliaryGeometry (const Model &parent, int dim=-1) |
Add auxiliary geometry (of the given dim, which may be -1) to the resource, embedded in its parent. | |
AuxiliaryGeometry | addAuxiliaryGeometry (const AuxiliaryGeometry &parent, int dim=-1) |
Add auxiliary geometry (of the given dim, which may be -1) to the resource, embedded in its parent. | |
Model | insertModel (const smtk::common::UUID &uid, int parametricDim=3, int embeddingDim=3, const std::string &name=std::string()) |
Add a model to the resource. More... | |
Model | addModel (int parametricDim=3, int embeddingDim=3, const std::string &name=std::string()) |
Add a model, creating a new UUID at the time. More... | |
Instance | addInstance () |
Add an instance of some model entity to the resource. More... | |
Instance | addInstance (const EntityRef &instanceOf) |
Add an instance with the given prototype to the resource. More... | |
Find entities by their property values. | |
Look for entities that have a given property defined and whose value matches one provided. The non-templated variants returning EntityRefArray can be wrapped and used in Python while the templated variants are more useful in C++. | |
EntityRefArray | findEntitiesByProperty (const std::string &pname, Integer pval) |
Find entities with an integer property named pname whose value is the single value pval. | |
EntityRefArray | findEntitiesByProperty (const std::string &pname, Float pval) |
Find entities with a floating-point property named pname whose value is the single value pval. | |
EntityRefArray | findEntitiesByProperty (const std::string &pname, const std::string &pval) |
Find entities with a string property named pname whose value is the single value pval. | |
EntityRefArray | findEntitiesByProperty (const std::string &pname, const IntegerList &pval) |
Find entities with an integer property named pname whose every value matches the array pval. | |
EntityRefArray | findEntitiesByProperty (const std::string &pname, const FloatList &pval) |
Find entities with a floating-point property named pname whose every value matches the array pval. | |
EntityRefArray | findEntitiesByProperty (const std::string &pname, const StringList &pval) |
Find entities with a string property named pname whose every value matches the array pval. | |
EntityRefArray | findEntitiesOfType (BitFlags flags, bool exactMatch=true) |
Find entities whose type matches the given flags. More... | |
template<typename Collection > | |
Collection | findEntitiesByPropertyAs (const std::string &pname, long pval) |
Return entities with a property named pname whose values match the given pval. | |
template<typename Collection > | |
Collection | findEntitiesByPropertyAs (const std::string &pname, const std::vector< long > &pval) |
Return entities with a property named pname whose values match the given pval. | |
template<typename Collection > | |
Collection | findEntitiesByPropertyAs (const std::string &pname, Float pval) |
Return entities with a property named pname whose values match the given pval. | |
template<typename Collection > | |
Collection | findEntitiesByPropertyAs (const std::string &pname, const std::vector< double > &pval) |
Return entities with a property named pname whose values match the given pval. | |
template<typename Collection > | |
Collection | findEntitiesByPropertyAs (const std::string &pname, const std::string &pval) |
Return entities with a property named pname whose values match the given pval. | |
template<typename Collection > | |
Collection | findEntitiesByPropertyAs (const std::string &pname, const std::vector< std::string > &pval) |
Return entities with a property named pname whose values match the given pval. | |
tess_iter_type | setTessellation (const smtk::common::UUID &cellId, const Tessellation &geom, int analysis=0, int *gen=nullptr) |
Set the tessellation information and for a given cellId. More... | |
tess_iter_type | setTessellationAndBoundingBox (const smtk::common::UUID &cellId, const Tessellation &geom, int analysis=0, int *gen=nullptr) |
Set the tessellation information and bounding box for a given cellId. More... | |
bool | setBoundingBox (const smtk::common::UUID &cellId, const std::vector< double > &coords, int providedBBox=0) |
set the bounding box of a model entity given entityId and coords. More... | |
bool | removeTessellation (const smtk::common::UUID &cellId, bool removeGen=false) |
Remove the tessellation of the given entityId. More... | |
int | arrangeEntity (const smtk::common::UUID &entityId, ArrangementKind, const Arrangement &arr, int index=-1) |
Add or replace information about the arrangement of an entity. More... | |
int | unarrangeEntity (const smtk::common::UUID &entityId, ArrangementKind, int index, bool removeIfLast=false) |
Remove an arrangement from an entity, and optionally the entity itself. More... | |
bool | clearArrangements (const smtk::common::UUID &entityId) |
Erase all arrangements for the given entityId. More... | |
const Arrangements * | hasArrangementsOfKindForEntity (const smtk::common::UUID &cellId, ArrangementKind) const |
This is a const version of hasArrangementsOfKindForEntity(). | |
Arrangements * | hasArrangementsOfKindForEntity (const smtk::common::UUID &cellId, ArrangementKind) |
Returns true when the given entity has any arrangements of the given kind (otherwise false). More... | |
Arrangements & | arrangementsOfKindForEntity (const smtk::common::UUID &cellId, ArrangementKind) |
Return an array of arrangements of the given kind for the given entity. More... | |
const Arrangement * | findArrangement (const smtk::common::UUID &entityId, ArrangementKind kind, int index) const |
Retrieve arrangement information for a cell. More... | |
Arrangement * | findArrangement (const smtk::common::UUID &entityId, ArrangementKind kind, int index) |
Retrieve arrangement information for an entity. More... | |
int | findArrangementInvolvingEntity (const smtk::common::UUID &entityId, ArrangementKind kind, const smtk::common::UUID &involved) const |
Find an arrangement of type kind that relates entityId to involvedEntity. More... | |
bool | findDualArrangements (const smtk::common::UUID &entityId, ArrangementKind kind, int index, ArrangementReferences &duals) const |
Find the inverse of the given arrangement, if it exists. More... | |
bool | addDualArrangement (const smtk::common::UUID &parent, const smtk::common::UUID &child, ArrangementKind kind, int sense, Orientation orientation) |
A method to add bidirectional arrangements between a parent and child. | |
int | findCellHasUseWithSense (const smtk::common::UUID &cellId, const smtk::common::UUID &use, int sense) const |
Find a particular arrangement: a cell's HAS_USE with a given sense. More... | |
std::set< int > | findCellHasUsesWithOrientation (const smtk::common::UUID &cellId, Orientation orient) const |
Find HAS_USE arrangements of a cell with a given orientation. More... | |
smtk::common::UUID | cellHasUseOfSenseAndOrientation (const smtk::common::UUID &cell, int sense, Orientation o) const |
Return the UUID of a use record for the given cell and sense, or nullptr if it does not exist. | |
smtk::common::UUID | findCreateOrReplaceCellUseOfSenseAndOrientation (const smtk::common::UUID &cell, int sense, Orientation o, const smtk::common::UUID &replacement=smtk::common::UUID::null()) |
Find a use record for the given cell and sense, creating one if it does not exist or replacing it if replacement is non-nullptr. | |
smtk::common::UUIDs | useOrShellIncludesShells (const smtk::common::UUID &cellUseOrShell) const |
Return the UUIDs of all shells included by the given cell-use or shell. More... | |
smtk::common::UUID | createIncludedShell (const smtk::common::UUID &cellUseOrShell) |
Add a new shell to the specified useOrShell entity as an inclusion. More... | |
bool | findOrAddIncludedShell (const smtk::common::UUID &parentUseOrShell, const smtk::common::UUID &shellToInclude) |
Add a shell to parentUseOrShell as an inclusion unless it already exists. More... | |
bool | findOrAddUseToShell (const smtk::common::UUID &shell, const smtk::common::UUID &use) |
Add a cell-use to a shell if it is not already contained in the shell. More... | |
bool | findOrAddInclusionToCellOrModel (const smtk::common::UUID &cell, const smtk::common::UUID &inclusion) |
Add an entity to a cell as a geometric inclusion. More... | |
bool | findOrAddEntityToGroup (const smtk::common::UUID &grp, const smtk::common::UUID &ent) |
Add an entity as a subset of a group. More... | |
smtk::resource::ResourceSet | associations () const |
Find entities with an integer property named pname whose value is the single value pval. | |
bool | associate (const smtk::resource::ResourcePtr &resource) |
Find entities with an integer property named pname whose value is the single value pval. | |
bool | disassociate (const smtk::resource::ResourcePtr &resource) |
Find entities with an integer property named pname whose value is the single value pval. | |
Attribute association | |
Associate and disassociate attribute values to entities. | |
bool | hasAttribute (const smtk::common::UUID &attribId, const smtk::common::UUID &toEntity) |
Report whether an entity has been assigned an attribute. | |
bool | associateAttribute (smtk::attribute::ResourcePtr attResource, const smtk::common::UUID &attribId, const smtk::common::UUID &toEntity) |
Assign an attribute to an entity. More... | |
bool | disassociateAttribute (smtk::attribute::ResourcePtr attResource, const smtk::common::UUID &attribId, const smtk::common::UUID &fromEntity, bool reverse=true) |
Unassign an attribute from an entity. | |
bool | insertEntityAssociations (const EntityRef &modelEntity, std::set< smtk::attribute::AttributePtr > &associations) |
Insert the attributes associated with modelEntity into the associations set. More... | |
std::set< smtk::attribute::AttributePtr > | associations (const EntityRef &modelEntity) |
Report whether an entity has been assigned an attribute. | |
![]() | |
bool | isOfType (const Resource::Index &index) const override |
given a resource index, return whether or not this resource is or is derived from the resource described by the index. | |
bool | isOfType (const std::string &typeName) const override |
given a resource's unique name, return whether or not this resource is or is derived from the resource described by the name. | |
int | numberOfGenerationsFromBase (const std::string &typeName) const override |
DerivedFrom (const DerivedFrom &)=delete | |
![]() | |
smtkTypeMacro (smtk::geometry::Resource) | |
smtkSuperclassMacro (smtk::resource::DerivedFrom< Resource, smtk::resource::Resource >) | |
smtkSharedFromThisMacro (smtk::resource::PersistentObject) | |
std::unique_ptr< Geometry > & | geometry (const Backend &backend) |
Given a backend, return a provider of geometry for that backend. More... | |
std::unique_ptr< Geometry > & | geometry () |
Return the first geometry provider (for any backend). More... | |
void | visitGeometry (std::function< void(std::unique_ptr< Geometry > &)> visitor) |
Visit all existing geometry providers for this resource. More... | |
Resource (Resource &&)=default | |
![]() | |
bool | isOfType (const Resource::Index &index) const override |
given a resource index, return whether or not this resource is or is derived from the resource described by the index. | |
bool | isOfType (const std::string &typeName) const override |
given a resource's unique name, return whether or not this resource is or is derived from the resource described by the name. | |
int | numberOfGenerationsFromBase (const std::string &typeName) const override |
DerivedFrom (const DerivedFrom &)=delete | |
![]() | |
smtkTypeMacro (smtk::resource::Resource) | |
smtkSuperclassMacro (smtk::resource::PersistentObject) | |
smtkSharedFromThisMacro (smtk::resource::PersistentObject) | |
virtual Index | index () const |
index is a compile-time intrinsic of the derived resource; as such, it cannot be set. | |
template<class ResourceType > | |
bool | isOfType () const |
given a resource type, return whether or not this resource is or is derived from the resource described by the index. | |
const smtk::common::UUID & | id () const override |
id and location are run-time intrinsics of the derived resource; we need to allow the user to reset these values. | |
const std::string & | location () const |
bool | setId (const smtk::common::UUID &myID) override |
Assign an ID to this object (used by readers; not for arbitrary reuse). More... | |
bool | setLocation (const std::string &location) |
std::string | name () const override |
Return the user-assigned name of the resource. More... | |
bool | setName (const std::string &name) |
bool | isNameSet () |
virtual bool | clean () const |
Indicate whether the resource is in sync with its location. More... | |
void | setClean (bool state=true) |
void | setMarkedForRemoval (bool val) |
Mark the resource to indicate it is about to removed (meaning it is being removed from memory not necessarily for deletion) | |
virtual bool | isMarkedForRemoval () const |
Return whether the object is marked for removal. | |
ManagerPtr | manager () const |
Resources that are managed have a non-null pointer to their manager. | |
virtual Component * | component (const smtk::common::UUID &compId) const |
Given a component's UUID, return a raw pointer to the component. | |
template<typename ComponentType > | |
ComponentType * | componentAs (const smtk::common::UUID &uuid) const |
A templated version of component() that casts its result to a type. More... | |
virtual void | visit (std::function< void(const ComponentPtr &)> &v) const =0 |
visit all components in a resource. | |
ComponentSet | filter (const std::string &queryString) const |
template<typename Collection > | |
Collection | filterAs (const std::string &queryString) const |
given a a std::string describing a query and a type of container, return a set of components that satisfy both. More... | |
Links & | links () override |
const Links & | links () const override |
Properties & | properties () override |
const Properties & | properties () const override |
const Queries & | queries () const |
Queries & | queries () |
Lock & | lock (Key()) const |
classes that are granted permission to the key may retrieve the resource's lock. | |
LockType | locked () const |
Anyone can query whether or not the resource is locked. | |
Resource (Resource &&) noexcept | |
![]() | |
smtkTypeMacroBase (smtk::resource::PersistentObject) | |
template<typename T > | |
T::Ptr | as () |
Attempt to cast this object to a subclass. | |
template<typename T > | |
T::ConstPtr | as () const |
Attempt to cast this object to a subclass. | |
Static Public Member Functions | |
static std::string | shortUUIDName (const smtk::common::UUID &uid, BitFlags entityFlags) |
Static Public Attributes | |
static constexpr smtk::resource::Links::RoleType | AssociationRole = -1 |
static constexpr smtk::resource::Links::RoleType | TessellationRole = -2 |
![]() | |
static const Resource::Index | type_index |
A static index for this resource type. More... | |
![]() | |
static const Resource::Index | type_index |
A static index for this resource type. More... | |
![]() | |
static const Resource::Index | type_index = std::type_index(typeid(Resource)).hash_code() |
Protected Types | |
typedef std::owner_less< smtk::attribute::WeakResourcePtr > | ResourceLessThan |
typedef std::set< smtk::attribute::WeakResourcePtr, ResourceLessThan > | WeakResourceSet |
Protected Member Functions | |
void | assignDefaultNamesWithOwner (const UUIDWithEntityPtr &irec, const smtk::common::UUID &owner, const std::string &ownersName, std::set< smtk::common::UUID > &remaining, bool nokids) |
std::string | assignDefaultName (const smtk::common::UUID &uid, BitFlags entityFlags) |
IntegerList & | entityCounts (const smtk::common::UUID &modelId, BitFlags entityFlags) |
Return a reference to the modelId's counter array associated with the given entityFlags. | |
void | prepareForEntity (std::pair< smtk::common::UUID, EntityPtr > &entry) |
Initialize storage outside of the topology() table for a new entity. More... | |
![]() | |
DerivedFrom (T &&... all) | |
Forward all constructor arguments to the parent class. | |
DerivedFrom (DerivedFrom &&rhs) noexcept=default | |
![]() | |
Resource (const smtk::common::UUID &myID, smtk::resource::ManagerPtr manager) | |
Resource (const smtk::common::UUID &myID) | |
Resource (smtk::resource::ManagerPtr manager=nullptr) | |
![]() | |
DerivedFrom (T &&... all) | |
Forward all constructor arguments to the parent class. | |
DerivedFrom (DerivedFrom &&rhs) noexcept=default | |
![]() | |
Resource (const smtk::common::UUID &, ManagerPtr manager=nullptr) | |
Resource (ManagerPtr manager=nullptr) | |
Protected Attributes | |
smtk::shared_ptr< UUIDsToEntities > | m_topology |
smtk::shared_ptr< UUIDsToTessellations > | m_tessellations |
smtk::shared_ptr< UUIDsToTessellations > | m_analysisMesh |
smtk::shared_ptr< UUIDsToAttributeAssignments > | m_attributeAssignments |
smtk::shared_ptr< UUIDsToSessions > | m_sessions |
WeakResourceSet | m_attributeResources |
smtk::shared_ptr< Session > | m_defaultSession |
IntegerList | m_globalCounters |
std::set< ConditionTrigger > | m_conditionTriggers |
std::set< OneToOneTrigger > | m_oneToOneTriggers |
std::set< OneToManyTrigger > | m_oneToManyTriggers |
![]() | |
WeakManagerPtr | m_manager |
Friends | |
class | smtk::attribute::Resource |
Callback methods | |
These methods provide observers with a way to register and receive notifications of modeling events. Events have 1 of 3 different signatures based on the type of event:
| |
void | observe (ResourceEventType event, ConditionCallback functionHandle, void *callData) |
Request notification from this resource instance when event occurs. | |
void | observe (ResourceEventType event, OneToOneCallback functionHandle, void *callData) |
Request notification from this resource instance when event occurs. | |
void | observe (ResourceEventType event, OneToManyCallback functionHandle, void *callData) |
Request notification from this resource instance when event occurs. | |
void | unobserve (ResourceEventType event, ConditionCallback functionHandle, void *callData) |
Decline further notification from this resource instance when event occurs. | |
void | unobserve (ResourceEventType event, OneToOneCallback functionHandle, void *callData) |
Decline further notification from this resource instance when event occurs. | |
void | unobserve (ResourceEventType event, OneToManyCallback functionHandle, void *callData) |
Decline further notification from this resource instance when event occurs. | |
void | trigger (ResourceEventType event, const smtk::model::EntityRef &src) |
Called by this Resource instance or EntityRef instances referencing it when event occurs. | |
void | trigger (ResourceEventType event, const smtk::model::EntityRef &src, const smtk::model::EntityRef &related) |
Called by this Resource instance or EntityRef instances referencing it when event occurs. | |
void | trigger (ResourceEventType event, const smtk::model::EntityRef &src, const smtk::model::EntityRefArray &related) |
Called by this Resource instance or EntityRef instances referencing it when event occurs. | |
smtk::common::UUID | modelOwningEntityRecursive (const smtk::common::UUID &uid, std::set< smtk::common::UUID > &visited) const |
Internal method used by modelOwningEntity to prevent infinite recursion. | |
smtk::common::UUID | sessionOwningEntityRecursive (const smtk::common::UUID &uid, std::set< smtk::common::UUID > &visited) const |
Attempt to find a session owning the given entity. | |
Store information about solid models.
Face smtk::model::Resource::addFace | ( | ) |
Group smtk::model::Resource::addGroup | ( | int | extraFlags = 0 , |
const std::string & | groupName = std::string() |
||
) |
Add a group, creating a new UUID in the process.
Instance smtk::model::Resource::addInstance | ( | ) |
Add an instance of some model entity to the resource.
An instance is a reference to some other item in the resource. Any entity may be instanced, but generally models are instanced as part of a scene graph.
Add an instance with the given prototype to the resource.
The prototype object (the parent of the instance) is a reference to some other item in the resource. Any entity may be instanced, but generally models are instanced as part of a scene graph.
Model smtk::model::Resource::addModel | ( | int | parametricDim = 3 , |
int | embeddingDim = 3 , |
||
const std::string & | modelName = std::string() |
||
) |
Add a model, creating a new UUID at the time.
|
virtual |
Add entities (specified by their uids) to the given group (groupId).
This will append groupId to each entity in uids. Note that this does not add the proper Arrangement information that Resource::findOrAddEntityToGroup() does, since Resource does not store Arrangement information.
int smtk::model::Resource::arrangeEntity | ( | const smtk::common::UUID & | entityId, |
ArrangementKind | kind, | ||
const Arrangement & | arr, | ||
int | index = -1 |
||
) |
Add or replace information about the arrangement of an entity.
When index is -1, the arrangement is considered new and added to the end of the vector of arrangements of the given kind. Otherwise, it should be positive and refer to a pre-existing arrangement to be replaced. The actual index location used is returned.
Arrangements & smtk::model::Resource::arrangementsOfKindForEntity | ( | const smtk::common::UUID & | cellId, |
ArrangementKind | kind | ||
) |
Return an array of arrangements of the given kind for the given entity.
NOTE: This method will create an empty array and attach it to the entity if none exists, thus increasing storage costs. Unless you intend to append new relationships, you should not use this method without first calling hasArrangementsOfKindForEntity() to determine whether the array already exists.
std::string smtk::model::Resource::assignDefaultName | ( | const smtk::common::UUID & | uid | ) |
Assign a string property named "name" to the given entity.
If a model can be identified as owning an entity, the default name assigned to the entity will be the model's name followed by a comma and then the name for the entity. The model's per-entity-type counters are used to number entities of the same type (e.g., "Face 13", "Edge 42").
Orphan entities (those without owning models) are given names that end with the trailing digits of their UUIDs.
std::string smtk::model::Resource::assignDefaultNameIfMissing | ( | const smtk::common::UUID & | uid | ) |
Assign a string property named "name" to the given entity.
This method is like assignDefaultName() but will not replace any pre-existing name.
void smtk::model::Resource::assignDefaultNames | ( | ) |
Assign a string property named "name" to every entity without one.
This descends sessions and models owned by sessions rather than blindly iterating over UUIDs; it is thus much faster than calling assignDefaultName() on each entity UUID.
void smtk::model::Resource::assignDefaultNamesToModelChildren | ( | const smtk::common::UUID & | modelId | ) |
Assign a string property named "name" to every entity of a model without one.
This descends models rather than blindly iterating over UUIDs; it is thus much faster than calling assignDefaultName() on each entity UUID.
bool smtk::model::Resource::associateAttribute | ( | smtk::attribute::ResourcePtr | attResource, |
const smtk::common::UUID & | attribId, | ||
const smtk::common::UUID & | toEntity | ||
) |
Assign an attribute to an entity.
This returns true when the attribute association is valid (whether it was previously associated or not) and false otherwise.
UUIDs smtk::model::Resource::bordantEntities | ( | const smtk::common::UUID & | ofEntity, |
int | ofDimension = -2 |
||
) | const |
Return the (Dimension+1 or higher)-entities that are the immediate bordants of the passed entity.
UUIDs smtk::model::Resource::bordantEntities | ( | const smtk::common::UUIDs & | ofEntities, |
int | ofDimension = -2 |
||
) | const |
Return the (Dimension+1 or higher)-entities that are the immediate bordants of any of the passed entities.
UUIDs smtk::model::Resource::boundaryEntities | ( | const smtk::common::UUID & | ofEntity, |
int | ofDimension = -2 |
||
) | const |
Return the (Dimension-1 or lower)-entities that are the immediate boundary of the passed entity.
UUIDs smtk::model::Resource::boundaryEntities | ( | const smtk::common::UUIDs & | ofEntities, |
int | ofDimension = -2 |
||
) | const |
Return the (Dimension-1 or lower)-entities that are the immediate boundary of any of the passed entities.
bool smtk::model::Resource::clearArrangements | ( | const smtk::common::UUID & | entityId | ) |
Erase all arrangements for the given entityId.
Returns true when entity had a non-empty dictionary of arrangements and false otherwise.
Note that this does not erase the entry in the map from UUIDs to arrangements, but rather clears the arrangement dictionary for the given UUID.
UUID smtk::model::Resource::createIncludedShell | ( | const smtk::common::UUID & | cellUseOrShell | ) |
Add a new shell to the specified useOrShell entity as an inclusion.
Cell-uses include shells relating the use to a grouping of lower-dimensional uses. Each shell included directly by a cell-use represents a disconnected component of the cell. Shells may also include other shells of the same dimensionality representing voids or material within voids for odd or even depths from the parent cell-use, respectively.
void smtk::model::Resource::elideEntityReferences | ( | const UUIDWithEntityPtr & | c | ) |
Given an entity c, ensure that all of its references contain no reference to it.
This is accomplished by overwriting matching references with UUID::null() rather than removing the reference from the array. We do things this way because indices into the list of relations are used by arrangements and we do not want to rewrite arrangements.
bool smtk::model::Resource::elideOneEntityReference | ( | const UUIDWithEntityPtr & | c, |
const smtk::common::UUID & | r | ||
) |
Given an entity c and the ID of one of its related entities r, overwrite the occurrence of r in c's array of relations with an invalid UUID.
Use this method to avoid the need to rewrite indices into c's array of relations held by c and potentially other entities related to c.
|
virtual |
Remove the entity with the given uid.
Returns true upon success, false when the entity did not exist.
Note that the implementation is aware of when the Resource is actually a Resource and removes storage from the Resource as well (including tessellation data).
Warning: Invoking this method naively will likely result in an inconsistent solid model. This does not cascade any changes required to remove dependent entities (i.e., removing a face does not remove any face-uses or shells that the face participated in, potentially leaving an improper volume boundary). The application is expected to perform further operations to keep the model valid.
|
virtual |
A convenience method for erasing a model and its children.
This removes the model plus all of its free cells, groups, and submodels from storage. This method will have no effect given an invalid model entity.
Arrangement * smtk::model::Resource::findArrangement | ( | const smtk::common::UUID & | entityId, |
ArrangementKind | kind, | ||
int | index | ||
) |
Retrieve arrangement information for an entity.
This version allows the arrangement to be altered.
const Arrangement * smtk::model::Resource::findArrangement | ( | const smtk::common::UUID & | entityId, |
ArrangementKind | kind, | ||
int | index | ||
) | const |
Retrieve arrangement information for a cell.
This version does not allow the arrangement to be altered.
int smtk::model::Resource::findArrangementInvolvingEntity | ( | const smtk::common::UUID & | entityId, |
ArrangementKind | kind, | ||
const smtk::common::UUID & | involved | ||
) | const |
Find an arrangement of type kind that relates entityId to involvedEntity.
This method returns the index upon success and a negative number upon failure.
std::set< int > smtk::model::Resource::findCellHasUsesWithOrientation | ( | const smtk::common::UUID & | cellId, |
Orientation | orient | ||
) | const |
Find HAS_USE arrangements of a cell with a given orientation.
The indices of the matching arrangements are returned.
int smtk::model::Resource::findCellHasUseWithSense | ( | const smtk::common::UUID & | cellId, |
const smtk::common::UUID & | use, | ||
int | sense | ||
) | const |
Find a particular arrangement: a cell's HAS_USE with a given sense.
The index of the matching arrangement is returned (or -1 if no such sense exists).
The sense is a non-negative integer corresponding to a particular use of a cell. However, the model may be altered in a way that some senses are no longer used. Rather than rewrite the cell and cell-use records to keep senses as a continuous integer sequence, we allow "holes" to exist in the list of senses. Just because a cell has a use with sense 5 does not imply that there is also a use with sense 4.
You may find all the HAS_USE arrangements of the cell and iterator over them to discover all the sense numbers.
There should be no duplicate senses for any given cell with the same orientation except in the case of vertex uses. Vertex uses have no orientation and each sense of a vertex corresponds to a unique connected point-set locus in the neighborhood of the domain with the vertex removed. So, a torus pinched to a conical point at one location on its boundary might have a periodic circular edge terminated by the same vertex at each end. However, the sense of the vertex uses for each endpoint would be different since subtracting the vertex from the bi-conic neighborhood yields distinct connected components. (The components are distinct inside small neighborhoods of the vertex even though the components are connected by an edge; this convention should be followed so that it is possible to compute deflection vectors that will remove the degeneracy of the vertex.)
bool smtk::model::Resource::findDualArrangements | ( | const smtk::common::UUID & | entityId, |
ArrangementKind | kind, | ||
int | index, | ||
ArrangementReferences & | duals | ||
) | const |
Find the inverse of the given arrangement, if it exists.
When an arrangement relates one entity to another, it usually has a dual, or inverse, arrangement stored with the other entity so that the relationship may be discovered given either of the entities involved.
Note that the dual is not related to sense or orientation; for example the dual of a face-cell's HAS_USE arrangement is not the opposite face. Rather, the dual is the face-use record's HAS_CELL arrangement (pointing from the face-use to the face-cell).
Because some relations are one-to-many in nature, it is possible for the dual of a relation to have multiple values. For example, a Shell's HAS_USE arrangement refer to many FaceUse instances. For this reason, findDualArrangements returns an array of duals.
This method and smtk::model::Arrangement::relations() are the two main methods which determine how arrangements should be interpreted in context without any prior constraints on the context. (Other methods create and interpret arrangements in specific circumstances where the context is known.)
EntityRefArray smtk::model::Resource::findEntitiesOfType | ( | BitFlags | flags, |
bool | exactMatch = true |
||
) |
Find entities whose type matches the given flags.
This version can be wrapped and used in Python. It is not named entitiesMatchingFlags (to mirror the templated entitiesMatchingFlagsAs<T>) because our base class, Resource, provides another method of the same name that returns UUIDs rather than EntityRefArray.
EntityPtr smtk::model::Resource::findEntity | ( | const smtk::common::UUID & | uid, |
bool | trySessions = true |
||
) | const |
Return the smtk::model::Entity associated with uid (or nullptr).
Note that even though const, this method may change the records in m_topology when trySessions is true (as transcription may modify existing entities to insert newly-transcribed relationships) since it may ask a Session instance to fetch a dangling UUID (one marked as existing but un-transcribed) and insert the Entity into Resource. If it is important that entities remain unchanged, call with the second argument (trySessions) set to false.
bool smtk::model::Resource::findOrAddEntityToGroup | ( | const smtk::common::UUID & | grp, |
const smtk::common::UUID & | ent | ||
) |
Add an entity as a subset of a group.
Note that no group/partition constraints are enforced. Returns true when the entity was successfully added (or already existed) and false upon failure (such as when grp or ent are invalid).
bool smtk::model::Resource::findOrAddIncludedShell | ( | const smtk::common::UUID & | parentUseOrShell, |
const smtk::common::UUID & | shellToInclude | ||
) |
Add a shell to parentUseOrShell as an inclusion unless it already exists.
Returns true when adding the shell was necessary. Returns false if either entity does not exist or the shell was already owned by the parent.
bool smtk::model::Resource::findOrAddInclusionToCellOrModel | ( | const smtk::common::UUID & | cell, |
const smtk::common::UUID & | inclusion | ||
) |
Add an entity to a cell as a geometric inclusion.
This attempts to add relationships and arrangements to both the cell and inclusion that indicate the latter is geometrically interior to the cell.
Thus, the inclusion must have a dimension less-than or equal to the cell.
bool smtk::model::Resource::findOrAddUseToShell | ( | const smtk::common::UUID & | shell, |
const smtk::common::UUID & | use | ||
) |
Add a cell-use to a shell if it is not already contained in the shell.
Note that cell-uses may have relations to shells of 2 different dimensions. This method should only be called when adding d-dimensional use-records to a shell bridging dimensions (d, d+1). For example, call this method when adding an edge-use to a loop and not when setting the edge-use associated with a chain. Use the findOrAddIncludedShell() method to do the latter.
The reason for this is that d-shells must have exactly one parent cell-use (or cell, for d=3), but may have many child cell-uses that are one dimension lower. A different type of relationship (INCLUDES/EMBEDDED_IN vs HAS_USE/HAS_SHELL) is employed depending on the dimension so that the distinction can be made easily.
SessionInfoBits smtk::model::Resource::hardErase | ( | const EntityRef & | eref, |
SessionInfoBits | flags = smtk::model::SESSION_EVERYTHING |
||
) |
Erase records related to the entity with no clean or safety checks.
Returns bit flags indicating what types of data were erased.
Warning: If flags contains SESSION_PROPERTIES and not SESSION_USER_DEFINED_PROPERTIES, then eref will be queried for its owning model and the model for its owning session. This can lead to problems if relationships have been erased by previous calls to hardErase.
Arrangements * smtk::model::Resource::hasArrangementsOfKindForEntity | ( | const smtk::common::UUID & | cellId, |
ArrangementKind | kind | ||
) |
Returns true when the given entity has any arrangements of the given kind (otherwise false).
Use this to avoid accidentally inserting a new array of arrangements with arrangementsOfKindForEntity(). Since this actually requires a lookup, you may pass in a pointer arr to an array of arrangements; if true is returned, the pointer will be aimed at the existing array. Otherwise, arr will be unchanged.
UUIDs smtk::model::Resource::higherDimensionalBordants | ( | const smtk::common::UUID & | ofEntity, |
int | higherDimension | ||
) |
Return higher-dimensional bordants of the passed d-dimensional entity.
higherDimension may be any dimension > d. Unlike Resource::bordantEntities(), this method will search the bordants of the entity's immediate bordants. For example, a 1-dimensional edge normally stores 2-dimensional faces as its immediate bordants, so if BoundaryEntities() is asked for 3-dimensional bordants none will usually be reported (the exception being when the edge is contained completely inside the volume and not attached to any boundary). But HigherDimensionalBoundaries() will return all the volumes the edge borders when asked for 3-dimensional boundaries.
Passing -1 will return all bordant entities of the specified entity, regardless of their dimension.
Resource::iter_type smtk::model::Resource::insertEntity | ( | EntityPtr | c | ) |
Insert the specified cell, returning an iterator.
If c has a null UUID, one will be generated and set; otherwise the existing UUID will be used when inserting into this class's map.
bool smtk::model::Resource::insertEntityAssociations | ( | const EntityRef & | modelEntity, |
std::set< smtk::attribute::AttributePtr > & | associations | ||
) |
Insert the attributes associated with modelEntity into the associations set.
Returns true when modelEntity had any attributes (whether they were already present in associations or not) in any attribute resource and false otherwise.
Note that attribute UUIDs may not be stored in any of the attribute resources (e.g., when a model was loaded from a save file but the attributes were not), in which case this method will return false even though attribute UUIDs were stored on the model entity. This way, a return value of true ensures that the set contains at least one entry.
Group smtk::model::Resource::insertGroup | ( | const smtk::common::UUID & | uid, |
int | extraFlags = 0 , |
||
const std::string & | groupName = std::string() |
||
) |
Add an entity group to the resource (without any relationships).
Any non-zero bits set in extraFlags are OR'd with entityFlags() of the group. This is an easy way to constrain the entities allowed to be members of the group.
You may also specify a name for the group. If name is empty, then no name is assigned.
Model smtk::model::Resource::insertModel | ( | const smtk::common::UUID & | uid, |
int | parametricDim = 3 , |
||
int | embeddingDim = 3 , |
||
const std::string & | modelName = std::string() |
||
) |
Add a model to the resource.
The model will have the specified embeddingDim set as an integer property named "embedding dimension." This is the dimension of the space in which vertex coordinates live.
A model may also be given a parametric dimension which is the maximum parametric dimension of any cell inserted into the model. The parametric dimension is the rank of the space spanned by the shape functions (for "parametric" meshes) or (for "discrete" meshes) barycentric coordinates of cells.
You may also specify a name for the model. If name is empty, then no name is assigned.
A model maintains counters used to number model entities by type (uniquely within the model). Any entities related to the model (directly or indirectly via topological relationships) may have these numbers assigned as names by calling assignDefaultNames().
UUIDs smtk::model::Resource::lowerDimensionalBoundaries | ( | const smtk::common::UUID & | ofEntity, |
int | lowerDimension | ||
) |
Return lower-dimensional boundaries of the passed d-dimensional entity.
lowerDimension may be any dimension < d. Unlike Resource::boundaryEntities(), this method will search the boundaries of the entity's boundaries. For example, a 2-dimensional face normally stores 1-dimensional edges as its immediate boundaries, so if BoundaryEntities() is asked for 0-dimensional entities none will usually be reported (the exception being an isolated vertex lying on the face with no edges attached). But LowerDimensionalBoundaries() will return the corners of the edges when asked for 0-dimensional boundaries.
Passing -1 will return all boundary entities of the specified entity, regardless of their dimension.
std::string smtk::model::Resource::name | ( | const smtk::common::UUID & | ofEntity | ) | const |
Return a name for the given entity ID.
This will either return a user-specified name or the "short UUID" name of the entity. It will not assign a name to the entity using the model counters because the method is const.
|
protected |
Initialize storage outside of the topology() table for a new entity.
This is an internal method invoked by setEntity and SetEntityOfTypeAndDimension.
bool smtk::model::Resource::removeTessellation | ( | const smtk::common::UUID & | entityId, |
bool | removeGen = false |
||
) |
Remove the tessellation of the given entityId.
If the second argument is true, also remove the integer "generation number" property from the entity.
Returns true when a tessellation was actually removed and false otherwise.
bool smtk::model::Resource::setBoundingBox | ( | const smtk::common::UUID & | cellId, |
const std::vector< double > & | coords, | ||
int | providedbBox = 0 |
||
) |
set the bounding box of a model entity given entityId and coords.
if provided bBox, we would just use the coords as bBox
Returns true when a real bBox is set and false otherwise.
Resource::iter_type smtk::model::Resource::setEntity | ( | EntityPtr | c | ) |
Map the specified cell c to the given uid.
Passing a nil or non-unique uid is an error here and will throw an exception.
Resource::iter_type smtk::model::Resource::setEntityOfTypeAndDimension | ( | const smtk::common::UUID & | uid, |
BitFlags | entityFlags, | ||
int | dim | ||
) |
Create and map a new cell of the given dimension to the given uid.
Passing a null or non-unique uid is an error here and will throw an exception.
Some checking and initialization is performed based on entityFlags and dim, as described below.
If the Resource may be cast to a Resource instance and an entity is expected to have a known, fixed number of arrangements of some sort, those are created here so that entityrefs may always rely on their existence even in the absence of the related UUIDs appearing in the entity's relations. For face cells (CELL_2D) entites, two HAS_USE Arrangements are created to reference FaceUse instances.
Resource::tess_iter_type smtk::model::Resource::setTessellation | ( | const smtk::common::UUID & | cellId, |
const Tessellation & | geom, | ||
int | analysis = 0 , |
||
int * | generation = nullptr |
||
) |
Set the tessellation information and for a given cellId.
If analysis is non-zero (zero is the default), then the Tessellation is treated as an analysis mesh, not a display tessellation.
Note that calling this method automatically sets or increments the integer-valued "_tessgen" property on cellId. This property enables fast display updates when only a few entity tessellations have changed. If generation is a non-nullptr pointer (nullptr is the default), then the new generation number of the Tessellation is stored at the address provided.
Resource::tess_iter_type smtk::model::Resource::setTessellationAndBoundingBox | ( | const smtk::common::UUID & | cellId, |
const Tessellation & | geom, | ||
int | analysis = 0 , |
||
int * | generation = nullptr |
||
) |
Set the tessellation information and bounding box for a given cellId.
If analysis is non-zero (zero is the default), then the Tessellation is treated as an analysis mesh, not a display tessellation.
Note that calling this method automatically sets or increments the integer-valued "_tessgen" property on cellId. This property enables fast display updates when only a few entity tessellations have changed. If generation is a non-nullptr pointer (nullptr is the default), then the new generation number of the Tessellation is stored at the address provided.
BitFlags smtk::model::Resource::type | ( | const smtk::common::UUID & | ofEntity | ) | const |
Queries on entities belonging to the solid.
Return the type of entity that the link represents.
int smtk::model::Resource::unarrangeEntity | ( | const smtk::common::UUID & | entityId, |
ArrangementKind | k, | ||
int | index, | ||
bool | removeIfLast = false |
||
) |
Remove an arrangement from an entity, and optionally the entity itself.
When no action is taken (because of a missing entityId, a missing arrangement or a bad index), 0 is returned. When a the arrangement is successfully removed, 1 is returned. When removeIfLast is true and the entity is removed, 2 is returned. When the related entity specified by the arrangement is also removed (only attempted when removeIfLast is true), 3 is returned.
Warning: Invoking this method naively will likely result in an inconsistent solid model. The caller is expected to perform further operations to keep the model valid.
bool smtk::model::Resource::unregisterSession | ( | SessionPtr | session, |
bool | expungeSession = true |
||
) |
Mark the end of a modeling session by removing its session.
This will remove session-member entities if expungeSession is true.
UUID smtk::model::Resource::unusedUUID | ( | ) |
Entity construction.
Return a currently-unused UUID (guaranteed not to collide if inserted immediately).
UUIDs smtk::model::Resource::useOrShellIncludesShells | ( | const smtk::common::UUID & | cellUseOrShell | ) | const |
Return the UUIDs of all shells included by the given cell-use or shell.
Cell-uses of dimension d may include shells that span dimensions d and (d-1). Shells may include other shells of the same dimensionality. These relationships define a hierarchy that enumerate the oriented boundary of the top-level cell-use.