SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Implement a session from VTK mesh files to SMTK. More...
#include <Session.h>
Public Types | |
typedef std::vector< vtkSmartPointer< vtkMultiBlockDataSet > > | ModelVector_t |
typedef std::map< smtk::model::EntityRef, EntityHandle > | ReverseIdMap_t |
typedef std::pair< vtkDataObject *, int > | ParentAndIndex_t |
typedef std::map< vtkDataObject *, ParentAndIndex_t > | ChildParentMap_t |
typedef smtk::model::SessionInfoBits | SessionInfoBits |
Public Member Functions | |
smtkTypeMacro (Session) | |
smtkSuperclassMacro (smtk::model::Session) | |
smtkSharedFromThisMacro (smtk::model::Session) | |
smtkCreateMacro (smtk::model::Session) | |
~Session () override | |
Destructor. | |
SessionInfoBits | allSupportedInformation () const override |
Return a bit vector describing what types of information can be transcribed. More... | |
Session (const Session &)=delete | |
Session & | operator= (const Session &)=delete |
EntityHandle | toEntity (const smtk::model::EntityRef &eid) |
Turn any valid entityref into an entity handle. | |
smtk::model::EntityRef | toEntityRef (const EntityHandle &ent) |
smtk::model::Model | addModel (vtkSmartPointer< vtkMultiBlockDataSet > &model, SessionInfoBits requestedInfo=smtk::model::SESSION_EVERYTHING) |
Add the dataset and its blocks to the session. | |
std::string | defaultFileExtension (const smtk::model::Model &model) const override |
Return a filename extension (including ".") appropriate for saving model. More... | |
bool | ensureChildParentMapEntry (vtkDataObject *child, vtkDataObject *parent, int idxInParent) |
ReverseIdMap_t & | reverseIdMap () |
size_t | numberOfModels () const |
Public Member Functions inherited from smtk::model::Session | |
smtkTypeMacroBase (smtk::model::Session) | |
smtkSuperclassMacro (smtk::model::Session) | |
smtkCreateMacro (smtk::model::Session) | |
virtual std::string | name () const |
Return the name of the session type (i.e., the name of the modeling kernel). More... | |
virtual std::string | className () const |
smtk::common::UUID | sessionId () const |
Return the session ID for this instance of the session. More... | |
int | transcribe (const EntityRef &entity, SessionInfoBits flags, bool onlyDangling=true, int depth=-1) |
Transcribe an entity from a foreign modeler into an SMTK storage Resource. More... | |
const DanglingEntities & | danglingEntities () const |
Return the map from dangling entityrefs to bits describing their partial transcription state. | |
void | declareDanglingEntity (const EntityRef &ent, SessionInfoBits present=0) |
Mark an entity, ent, as partially transcribed. More... | |
virtual int | setup (const std::string &optName, const StringList &optVal) |
Set configuration options on the session. More... | |
ResourcePtr | resource () const |
Return a reference to the resource that owns this Session. | |
smtk::io::Logger & | log () |
Return the log (obtained from the model resource). | |
virtual bool | splitEntity (const EntityRef &from, const EntityRefs &to) const |
virtual bool | mergeEntities (const EntityRefs &from, EntityRef &to) const |
virtual bool | splitAttributes (const EntityRef &from, const EntityRefs &to) const |
Called when an entity is being split so that attribute assignments can be updated. More... | |
virtual bool | mergeAttributes (const EntityRefs &from, EntityRef &to) const |
Called when an entity is being split so that attribute assignments can be updated. More... | |
virtual bool | removeGeneratedProperties (const EntityRef &ent, SessionInfoBits propFlags) |
This is used by the resource when erasing a model entity. More... | |
virtual bool | splitProperties (const EntityRef &from, const EntityRefs &to) const |
Called when an entity is being split or cut into one or more descendants. More... | |
virtual bool | mergeProperties (const EntityRefs &from, EntityRef &to) const |
Called when one or more entities are being merged or joined into a descendant. More... | |
Static Public Member Functions | |
static vtkInformationIntegerKey * | SMTK_DIMENSION () |
static vtkInformationIntegerKey * | SMTK_VISIBILITY () |
static vtkInformationIntegerKey * | SMTK_GROUP_TYPE () |
static vtkInformationIntegerKey * | SMTK_PEDIGREE () |
static vtkInformationIntegerKey * | SMTK_OUTER_LABEL () |
static vtkInformationObjectBaseVectorKey * | SMTK_CHILDREN () |
static vtkInformationDoubleKey * | SMTK_LABEL_VALUE () |
static bool | transcriptionChecksEnabled () |
Get/set whether adding cells to models during transcription will check for pre-existing entries to avoid adding duplicates. More... | |
static void | setEnableTranscriptionChecks (bool doCheck) |
Static Public Member Functions inherited from smtk::model::Session | |
static std::string | staticClassName () |
Protected Member Functions | |
SessionInfoBits | transcribeInternal (const smtk::model::EntityRef &entity, SessionInfoBits requestedInfo, int depth=-1) override |
Transcribe information requested by flags into entity from foreign modeler. More... | |
vtkDataObject * | modelOfHandle (const EntityHandle &h) const |
Return the model owning the given handle, h. | |
vtkDataObject * | parent (vtkDataObject *obj) const |
Return the parent dataset of obj. | |
int | parentIndex (vtkDataObject *obj) const |
Return the index of obj in its parent's list of children. | |
smtk::common::UUID | uuidOfHandleObject (vtkDataObject *obj) const |
template<typename T > | |
T * | modelOfHandleAs (const EntityHandle &h) const |
template<typename T > | |
T * | parentAs (vtkDataObject *obj) const |
smtk::model::SessionIOPtr | createIODelegate (const std::string &format) override |
Return a delegate to export session-specific data. More... | |
Protected Member Functions inherited from smtk::model::Session | |
Session () | |
Default constructor. This assigns a random session ID to each Session instance. | |
void | setSessionId (const smtk::common::UUID &sessId) |
Set the session ID. More... | |
void | setResource (Resource *resource) |
Inform this instance of the session that it is owned by resource. | |
virtual EntityPtr | addEntityRecord (const EntityRef &entRef) |
Subclasses implement this; it should add a record for entRef to the resource. | |
virtual ArrangementHelper * | createArrangementHelper () |
Subclasses implement this; it should return a new ArrangementHelper subclass instance. More... | |
int | findOrAddRelatedEntities (const EntityRef &entRef, SessionInfoBits flags, ArrangementHelper *helper) |
Recursively called by transcribeInternal until no new entities are encountered. | |
virtual int | findOrAddCellAdjacencies (const CellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add boundary, bounding, embedded, and embeddor cells of the current cell. | |
virtual int | findOrAddCellUses (const CellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add use records of the current cell. | |
virtual int | findOrAddOwningCell (const UseEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add the current use's owning cell. | |
virtual int | findOrAddShellAdjacencies (const UseEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add shells bounded by or bounding the given use. | |
virtual int | findOrAddUseAdjacencies (const ShellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddGroupOwner (const Group &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddFreeCells (const Model &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedModels (const Model &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddPrototype (const Instance &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedModels (const SessionRef &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedGroups (const EntityRef &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedInstances (const EntityRef &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual SessionInfoBits | findOrAddArrangements (const EntityRef &entRef, EntityPtr entRec, SessionInfoBits flags, ArrangementHelper *helper) |
Subclasses implement this to finalize arrangement information for entRef using the helper. | |
virtual SessionInfoBits | updateProperties (const EntityRef &entRef, EntityPtr entRec, SessionInfoBits flags, ArrangementHelper *helper) |
Subclasses implement this to update transcribed (not user-specified) properties of entRef. | |
virtual SessionInfoBits | updateTessellation (const EntityRef &entRef, SessionInfoBits flags, ArrangementHelper *helper) |
Sublasses implement this to update the tessellation of the given entRef. More... | |
Protected Attributes | |
ModelVector_t | m_models |
ReverseIdMap_t | m_revIdMap |
ChildParentMap_t | m_cpMap |
Protected Attributes inherited from smtk::model::Session | |
DanglingEntities | m_dangling |
smtk::common::UUID | m_sessionId |
Resource * | m_resource { nullptr } |
Static Protected Attributes | |
static bool | s_transcriptionChecks = true |
Friends | |
struct | EntityHandle |
Implement a session from VTK mesh files to SMTK.
This session uses the VTK VTK reader to obtain information from VTK files, with each element block, side set, and node set represented as a vtkUnstructuredGrid.
|
inlineoverridevirtual |
Return a bit vector describing what types of information can be transcribed.
This is used to determine when an entity has been fully transcribed into storage and is no longer "dangling."
Reimplemented from smtk::model::Session.
|
overrideprotectedvirtual |
Return a delegate to export session-specific data.
If your session needs to store additional information when being serialized to JSON or some other format (only JSON is currently supported), this method is called by the exporter to create an object used to write this data.
Reimplemented from smtk::model::Session.
|
overridevirtual |
Return a filename extension (including ".") appropriate for saving model.
Subclasses of session should override this method. If a method returns the empty string, it indicates that the model requires no "native" model file. (The polygon session is an example of this where all information is saved in the SMTK file.)
Reimplemented from smtk::model::Session.
|
overrideprotectedvirtual |
Transcribe information requested by flags into entity from foreign modeler.
This method should return a non-zero value upon success. Upon success, flags should be modified to represent the actual information transcribed (as opposed to what was requested). This should always be at least the information requested but may include more information.
Currently, it really only makes sense to call this method on a Model (i.e., not an edge, face, etc.); entire models at a time are retranscribed.
Subclasses may override this method. If they do not, they should implement the virtual relationship helper methods.
Reimplemented from smtk::model::Session.
|
inlinestatic |
Get/set whether adding cells to models during transcription will check for pre-existing entries to avoid adding duplicates.
This defaults to true, but some operations such as imports may wish to diable for efficiency (if adding many cells to a model that cannot already be present on the model).