Commit 27ca669a authored by David Thompson's avatar David Thompson

A large rename to address issue #5.

parent 7f61bf20
......@@ -18,16 +18,16 @@
// Was SMTK built with VTK? If true, the vtkSMTK library will exist.
#cmakedefine SMTK_BUILD_VTK
// Was SMTK built with discrete model? If true, the smtkDiscreteBridge library
// Was SMTK built with discrete model? If true, the smtkDiscreteSession library
// and vtkSMTKDiscreteModel library will exist.
#cmakedefine SMTK_BUILD_DISCRETE_BRIDGE
#cmakedefine SMTK_BUILD_DISCRETE_SESSION
// Was SMTK built with exodus-II reader? If true,
// the SMTKBridgeExodus library will exist.
#cmakedefine SMTK_ENABLE_EXODUS_BRIDGE
// the SMTKSessionExodus library will exist.
#cmakedefine SMTK_ENABLE_EXODUS_SESSION
// Was SMTK built with moab reader? If true, the vtkDiscreteMoabReader
// library will exist and smtkDiscreteBridge library will link against it.
// library will exist and smtkDiscreteSession library will link against it.
#cmakedefine SMTK_BUILD_MOAB_READER
// Was SMTK built with CGM? If true, cgm-convert will exist.
......
......@@ -103,7 +103,7 @@ function(smtk_prepend_string prefix result)
endfunction(smtk_prepend_string)
include(SMTKOperatorXML)
include(SMTKBridgeJSON)
include(SMTKSessionJSON)
# Builds source groups for the smtk files so that they show up nicely in
# Visual Studio.
......
# Given a list of filenames (opSpecs) containing JSON descriptions of
# a bridge, configure C++ source that encodes the JSON as a string.
# a session, configure C++ source that encodes the JSON as a string.
# The resulting files are placed in the current binary directory and
# appended to genFiles.
include(EncodeCStringFunctions)
function(smtk_bridge_json opSpecs genFiles)
function(smtk_session_json opSpecs genFiles)
foreach (opSpec ${opSpecs})
get_filename_component(genFileBase "${opSpec}" NAME_WE)
set(genFile "${CMAKE_CURRENT_BINARY_DIR}/${genFileBase}_json.h")
......
......@@ -13,4 +13,4 @@ int main(int argc, char** argv)
{
std::shared_ptr<float> f;
return 0;
}
\ No newline at end of file
}
......@@ -13,4 +13,4 @@ int main(int argc, char** argv)
{
std::tr1::shared_ptr<float> f;
return 0;
}
\ No newline at end of file
}
......@@ -104,4 +104,4 @@ macro(vtk_smtk_setup_module_environment _name)
vtk_module_load("${mod}")
endforeach()
endmacro()
\ No newline at end of file
endmacro()
......@@ -49,11 +49,11 @@ option(SMTK_NO_SYSTEM_BOOST "Allow boost to search for system installed boost" O
option(SMTK_BUILD_QT "Build Qt GUI" OFF)
option(SMTK_BUILD_VTK "Build VTK component" OFF)
option(SMTK_BUILD_CGM "Build CGM component" OFF)
option(SMTK_BUILD_DISCRETE_BRIDGE "Build discrete model bridge components" OFF)
option(SMTK_BUILD_BRIDGE_PLUGIN "Build paraview plugin for model bridges" OFF)
option(SMTK_BUILD_DISCRETE_SESSION "Build discrete model session components" OFF)
option(SMTK_BUILD_SESSION_PLUGIN "Build paraview plugin for model sessions" OFF)
if (SMTK_BUILD_VTK)
option(SMTK_ENABLE_EXODUS_BRIDGE "Build a bridge to Exodus-II side sets" ON)
option(SMTK_ENABLE_EXODUS_SESSION "Build a session to Exodus-II side sets" ON)
endif()
option(SMTK_ENABLE_REMUS "Build Remus component" OFF)
......@@ -142,10 +142,10 @@ endif()
# and VTK can NOT be easily switched due to modules and macros intermixed
################################################################################
################################################################################
# Look for Discrete bridge discrete model modules
# Look for Discrete session discrete model modules
################################################################################
if(SMTK_BUILD_BRIDGE_PLUGIN)
if(SMTK_BUILD_SESSION_PLUGIN)
find_package(ParaView REQUIRED)
endif()
......@@ -154,7 +154,7 @@ endif()
################################################################################
if(SMTK_BUILD_VTK)
if(SMTK_BUILD_BRIDGE_PLUGIN)
if(SMTK_BUILD_SESSION_PLUGIN)
find_package(ParaView REQUIRED)
else()
# Find the package here so environment variables are set, but
......@@ -317,7 +317,7 @@ install(
FILES
${PROJECT_SOURCE_DIR}/CMake/EncodeCStringFunctions.cmake
${PROJECT_SOURCE_DIR}/CMake/SMTKOperatorXML.cmake
${PROJECT_SOURCE_DIR}/CMake/SMTKBridgeJSON.cmake
${PROJECT_SOURCE_DIR}/CMake/SMTKSessionJSON.cmake
DESTINATION
lib/cmake/SMTK
)
......@@ -345,17 +345,17 @@ include_directories(
)
################################################################################
# Look for Discrete bridge discrete model modules
# Look for Discrete session discrete model modules
################################################################################
if(SMTK_BUILD_DISCRETE_BRIDGE)
if(SMTK_BUILD_BRIDGE_PLUGIN)
if(SMTK_BUILD_DISCRETE_SESSION)
if(SMTK_BUILD_SESSION_PLUGIN)
find_package(ParaView REQUIRED)
else()
find_package(VTK REQUIRED)
endif()
# This option is only available when SMTK_BUILD_DISCRETE_BRIDGE is ON
# This option is only available when SMTK_BUILD_DISCRETE_SESSION is ON
option(SMTK_BUILD_MOAB_READER "Build moab reader for discrete model" OFF)
endif()
......
......@@ -115,7 +115,7 @@ if (SPHINX_FOUND)
userguide/attribute/file-syntax.rst
userguide/model/index.rst
userguide/model/concepts.rst
userguide/model/bridges.rst
userguide/model/sessions.rst
userguide/model/property-names.rst
userguide/contributing.rst
)
......@@ -126,8 +126,8 @@ if (SPHINX_FOUND)
endif()
set(SMTK_USERGUIDE_FIGS
userguide/figures/forwarding-bridge.svg
userguide/figures/cursor-classes-with-inheritance.svg
userguide/figures/forwarding-session.svg
userguide/figures/entityref-classes-with-inheritance.svg
userguide/figures/ExampleAttributePanel.png
)
......
......@@ -671,7 +671,7 @@ WARN_LOGFILE =
INPUT = \
"@SMTK_SOURCE_DIR@/smtk" \
"@SMTK_SOURCE_DIR@/smtk/attribute" \
"@SMTK_SOURCE_DIR@/smtk/bridge" \
"@SMTK_SOURCE_DIR@/smtk/session" \
"@SMTK_SOURCE_DIR@/smtk/bridge/remote" \
"@SMTK_SOURCE_DIR@/smtk/bridge/cgm" \
"@SMTK_SOURCE_DIR@/smtk/bridge/discrete" \
......
project(ex_add_a_bridge)
project(ex_add_a_session)
cmake_minimum_required(VERSION 2.8.11)
# ++ 1 ++
include(SMTKBridgeJSON) # defines smtk_bridge_json()
include(SMTKSessionJSON) # defines smtk_session_json()
# The smtk_bridge_json() function writes a file to the current
# The smtk_session_json() function writes a file to the current
# binary directory sharing the same name as the input file
# but with "_json.h" replacing the file extension. For this
# example, that filename is "Bridge_json.h".
# smtk_bridge_json() appends the exact filename to the
# "bridgeJSON" variable.
smtk_bridge_json(
"${CMAKE_CURRENT_SOURCE_DIR}/Bridge.json"
bridgeJSON
# example, that filename is "Session_json.h".
# smtk_session_json() appends the exact filename to the
# "sessionJSON" variable.
smtk_session_json(
"${CMAKE_CURRENT_SOURCE_DIR}/Session.json"
sessionJSON
)
# Make sure we can include the resulting file:
......@@ -22,10 +22,10 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
# Testing must be enabled to build this tutorial
# because it depends on SMTKCoreModelTesting.
#if (SMTK_ENABLE_TESTING)
# add_executable(add_a_bridge add_a_bridge.cxx)
# target_link_libraries(add_a_bridge SMTKCore SMTKCoreModelTesting)
# add_executable(add_a_session add_a_session.cxx)
# target_link_libraries(add_a_session SMTKCore SMTKCoreModelTesting)
# if (SMTK_BUILD_CGM)
# target_link_libraries(add_a_bridge cgmSMTK)
# target_link_libraries(add_a_session cgmSMTK)
# endif (SMTK_BUILD_CGM)
# add_test(tut-add_a_bridge ${EXECUTABLE_OUTPUT_PATH}/add_a_bridge)
# add_test(tut-add_a_session ${EXECUTABLE_OUTPUT_PATH}/add_a_session)
#endif()
......@@ -7,10 +7,10 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#ifndef __smtk_ex_bridge_h
#define __smtk_ex_bridge_h
#ifndef __smtk_ex_session_h
#define __smtk_ex_session_h
#include "smtk/model/Bridge.h"
#include "smtk/model/Session.h"
#include "smtk/common/UUID.h"
#include "vtkSmartPointer.h"
......@@ -43,22 +43,22 @@ struct EntityHandle {
// -- 2 --
// ++ 1 ++
/**\brief Implement a bridge from VTK unstructured grids to SMTK.
/**\brief Implement a session from VTK unstructured grids to SMTK.
*/
class Bridge : public smtk::model::Bridge
class Session : public smtk::model::Session
{
public:
// This is required of every bridge:
// This is required of every session:
smtkDeclareModelingKernel();
typedef smtk::shared_ptr<Bridge> Ptr;
typedef smtk::model::BridgedInfoBits BridgedInfoBits;
static BridgePtr create();
virtual ~Bridge();
virtual BridgedInfoBits allSupportedInformation() const;
typedef smtk::shared_ptr<Session> Ptr;
typedef smtk::model::SessiondInfoBits SessiondInfoBits;
static SessionPtr create();
virtual ~Session();
virtual SessiondInfoBits allSupportedInformation() const;
// These are specific to each bridge but required in some form:
EntityHandle toEntity(const smtk::model::Cursor& eid);
smtk::model::Cursor toCursor(const EntityHandle& ent);
// These are specific to each session but required in some form:
EntityHandle toEntity(const smtk::model::EntityRef& eid);
smtk::model::EntityRef toEntityRef(const EntityHandle& ent);
// These methods may be provided as needed.
static int staticSetup(
......@@ -69,33 +69,33 @@ public:
const smtk::model::StringList& optVal);
protected:
Bridge();
Session();
// This is required of every bridge:
virtual BridgedInfoBits transcribeInternal(
const smtk::model::Cursor& entity,
BridgedInfoBits requestedInfo);
// This is required of every session:
virtual SessiondInfoBits transcribeInternal(
const smtk::model::EntityRef& entity,
SessiondInfoBits requestedInfo);
vtkSmartPointer<vtkUnstructuredGrid> Model;
// ... };
// -- 1 --
void addRelations(
smtk::model::Cursor& cursor,
smtk::model::EntityRef& entityref,
std::vector<EntityHandle>& rels,
BridgedInfoBits requestedInfo,
SessiondInfoBits requestedInfo,
int depth);
bool addTessellation(
const smtk::model::Cursor&,
const smtk::model::EntityRef&,
const EntityHandle&);
private:
Bridge(const Bridge&); // Not implemented.
void operator = (const Bridge&); // Not implemented.
Session(const Session&); // Not implemented.
void operator = (const Session&); // Not implemented.
};
} // namespace tutorial
} // namespace bridge
} // namespace smtk
#endif // __smtk_ex_bridge_h
#endif // __smtk_ex_session_h
......@@ -9,7 +9,7 @@ Adding Entity UUIDs
*******************
The first step in adapting foreign modeling kernels to SMTK,
which you should do before you start subclassing Bridge,
which you should do before you start subclassing Session,
is deciding how to assign UUIDs to entities in the foreign
modeling kernel so that
......@@ -39,7 +39,7 @@ UUIDs:
it also saves session information, it can be used to
"restore" a modeling session so that the same files
are loaded on the server and the UUIDs preserved.
*This is the approach our Exodus bridge example takes.*
*This is the approach our Exodus session example takes.*
The advantage to the first approach is that modeling
kernels with attribute systems generally provide a way
......@@ -51,7 +51,7 @@ the topology of the model.
Adding UUIDs by either technique
--------------------------------
Regardless of the path you take above, your bridge should provide
Regardless of the path you take above, your session should provide
public methods to map both directions.
The function mapping UUIDs to foreign entities will have a
return type that is specific to your modeling kernel,
......@@ -59,7 +59,7 @@ as will the input parameter of the inverse method that
returns a UUID given a foreign entity;
for our example, we've created a new type named :cxx:`EntityHandle`.
.. literalinclude:: ../../../smtk/bridge/exodus/Bridge.h
.. literalinclude:: ../../../smtk/bridge/exodus/Session.h
:start-after: // ++ 2 ++
:end-before: // -- 2 --
......@@ -68,12 +68,12 @@ or group it exposes to SMTK:
(1) the type of object being exposed (an Exodus model, an element
block, a side set, or a node set),
(2) the offset of the model in a vector of vtkMultiBlockDataSet
instances held by the bridge (one per Exodus file)
instances held by the session (one per Exodus file)
(3) the ID of the block holding the vtkUnstructuredGrid that contains
the tessellation information for the object (or -1 when the object
is an Exodus MODEL since it has no tessellation, only groups).
Given an :cxx:`EntityHandle` we can easily look up the vtkUnstructuredGrid
in the Bridge's :cxx:`m_models` member.
in the Session's :cxx:`m_models` member.
Adding UUIDs as attributes
--------------------------
......@@ -84,7 +84,7 @@ attribute system either as a 16-byte binary blob or an ASCII string
per entity.
For example, if we wished to make VTK points and cells available
via a bridge, we could store UUIDs on VTK grids as point and cell data arrays.
via a session, we could store UUIDs on VTK grids as point and cell data arrays.
It would be more space-efficient to store these in a 2-component
:cxx:`vtkTypeUInt64Array` (2 components for a total of 128 bits per UUID),
but much easier to debug if we store UUIDs in :cxx:`vtkStringArray`
......@@ -105,10 +105,10 @@ UUIDs and assigning it to the vtkInformation object on the dataset
or filter.
Although not required by this technique, you should be aware that you
may store information about a particular bridge session instance in
an SMTK JSON file by subclassing the :smtk:`BridgeIOJSON` class.
may store information about a particular session session instance in
an SMTK JSON file by subclassing the :smtk:`SessionIOJSON` class.
.. _bridge-by-sequence:
.. _session-by-sequence:
Adding UUIDs as sequences
-------------------------
......@@ -116,16 +116,16 @@ Adding UUIDs as sequences
If you must store UUIDs in an SMTK JSON file according to some stable
traversal order, then you should
1. store the arrays in your bridge class in the proper order and use
1. store the arrays in your session class in the proper order and use
them to perform the lookups.
.. literalinclude:: ../../../smtk/bridge/exodus/Bridge.cxx
.. literalinclude:: ../../../smtk/bridge/exodus/Session.cxx
:start-after: // ++ 2 ++
:end-before: // -- 2 --
2. subclass :smtk:`BridgeIOJSON` in order to preserve the UUID arrays:
2. subclass :smtk:`SessionIOJSON` in order to preserve the UUID arrays:
.. literalinclude:: ../../../smtk/bridge/exodus/BridgeExodusIOJSON.h
.. literalinclude:: ../../../smtk/bridge/exodus/SessionExodusIOJSON.h
:start-after: // ++ 1 ++
:end-before: // -- 1 --
......@@ -143,4 +143,4 @@ Future versions of SMTK will focus on incremental transcription of
model entities to avoid significant waits the first time a model is read.
Now that you understand how UUIDs will be stored and related to foreign
modeling kernel entities, it is possible to subclass the SMTK model bridge class.
modeling kernel entities, it is possible to subclass the SMTK model session class.
============================
Bridge a new modeling kernel
Session a new modeling kernel
============================
.. highlight:: c++
.. role:: cxx(code)
:language: c++
This tutorial covers how to bridge a solid modeling kernel to SMTK.
This tutorial covers how to session a solid modeling kernel to SMTK.
The details will vary according to the capabilities of the modeling
kernel you wish to use via SMTK, but the overall process of bridging
the kernel involves
* subclassing SMTK's :smtk:`Bridge` class,
* subclassing SMTK's :smtk:`Session` class,
* defining a map between your kernel's modeling entities and SMTK UUIDs,
* transcribing information about kernel modeling entities into an
SMTK model manager, and
......@@ -19,10 +19,10 @@ the kernel involves
mandatory operator is a "read" operator used to load a file native
to your modeling kernel into your native kernel's modeling session.
This tutorial will use a simplistic bridge that presents an Exodus
This tutorial will use a simplistic session that presents an Exodus
mesh as a model composed only of groups (element blocks, side sets,
and node sets).
A bridge like this is useful for cases where the geometry for a
A session like this is useful for cases where the geometry for a
simulation has been completely prepared and SMTK is only being
used to attach attributes to pre-existing subsets of the geometric
model.
......@@ -33,7 +33,7 @@ these cells to SMTK.
.. toctree::
entity_uuids.rst
bridge_subclass.rst
session_subclass.rst
transcribing.rst
operators.rst
troubleshooting.rst
......@@ -3,5 +3,5 @@ Providing operators
*******************
Finally, if you wish to allow modeling operations,
your bridge must provide :smtk:`Operator` definitions
your session must provide :smtk:`Operator` definitions
that invoke the underlying modeling kernel.
......@@ -2,65 +2,65 @@
Transcribing model entities
***************************
The main purpose of the bridge is to provide the SMTK model Manager
The main purpose of the session is to provide the SMTK model Manager
which owns it with information about the entities in some foreign modeler
and the :smtk:`Bridge::transcribeInternal` method is where your bridge
and the :smtk:`Session::transcribeInternal` method is where your session
must do this.
The first thing you should do is verify that the entity being requested
actually exists:
.. literalinclude:: ../../../smtk/bridge/exodus/Bridge.cxx
.. literalinclude:: ../../../smtk/bridge/exodus/Session.cxx
:start-after: // ++ 7 ++
:end-before: // -- 7 --
One trick you'll see in most bridges is the construction of a "mutable" cursor
One trick you'll see in most sessions is the construction of a "mutable" entityref
from the const version that passed to :cxx:`transcribeInternal`:
.. literalinclude:: ../../../smtk/bridge/exodus/Bridge.cxx
.. literalinclude:: ../../../smtk/bridge/exodus/Session.cxx
:start-after: // ++ 8 ++
:end-before: // -- 8 --
The const version does not provide access to methods that alter the model manager's storage.
Constructing a mutable version of the cursor is legitimate inside the bridge
Constructing a mutable version of the entityref is legitimate inside the session
we are pretending that the entity to be transcribed has existed in the manager
ever since it existed in the foreign modeler.
Since transcription should not change the entity in the foreign modeler,
creating a mutable cursor is acceptable.
creating a mutable entityref is acceptable.
Once you know that the UUID has a matching entity in the foreign modeler,
you should create an :smtk:`Entity` instance in the model manager's map
from UUIDs to entities.
Make sure that the entity's flags properly define the type of the entity
at this point but don't worry about filling in the list of relations to
other entities unless the :smtk:`BRIDGE_ENTITY_RELATIONS` bit is set
other entities unless the :smtk:`SESSION_ENTITY_RELATIONS` bit is set
in the request for transcription.
.. literalinclude:: ../../../smtk/bridge/exodus/Bridge.cxx
.. literalinclude:: ../../../smtk/bridge/exodus/Session.cxx
:start-after: // ++ 9 ++
:end-before: // -- 9 --
.. literalinclude:: ../../../smtk/bridge/exodus/Bridge.cxx
.. literalinclude:: ../../../smtk/bridge/exodus/Session.cxx
:start-after: // ++ 10 ++
:end-before: // -- 10 --
If :smtk:`BRIDGE_ENTITY_RELATIONS` is set, then you not only need to
If :smtk:`SESSION_ENTITY_RELATIONS` is set, then you not only need to
ensure that the relations are listed but that they are also *at least*
partially transcribed.
You are always welcome to transcribe more than is requested,
but be aware that this can slow things down for large models.
Because this is an example and because the Exodus bridge does not
Because this is an example and because the Exodus session does not
expose individual cells as first-class entities,
we transcribe the entire model recursively.
.. literalinclude:: ../../../smtk/bridge/exodus/Bridge.cxx
.. literalinclude:: ../../../smtk/bridge/exodus/Session.cxx
:start-after: // ++ 11 ++
:end-before: // -- 11 --
Now you should check other bits in :smtk:`BridgedInformation` that
are present in your :smtk:`Bridge::allSupportedInformation` method
Now you should check other bits in :smtk:`SessiondInformation` that
are present in your :smtk:`Session::allSupportedInformation` method
and ensure that information is transcribed properly before returning
the bits which were actually transcribed for the given entity.
The :smtk:`Bridge::transcribe` method uses the return value to
The :smtk:`Session::transcribe` method uses the return value to
update its list of dangling (partially transcribed) entities.
Troubleshooting
---------------
If you have implemented a bridge but are having problems getting it
If you have implemented a session but are having problems getting it
to run properly,
* Make sure that your Bridge constructor calls :smtk:`Bridge::initializeOperatorSystem`.
* Make sure that your Session constructor calls :smtk:`Session::initializeOperatorSystem`.
Failure to do this will result in crashes when trying to
create an operator, register an operator, or obtain a list of operator names.
* If you would like to run a model worker process in the debugger instead of
having it started automatically by the process-local server created in
:smtk:`RemusBridgeConnection::connectToServer`, you can set the
:smtk:`RemusConnection::connectToServer`, you can set the
:cxx:`SMTK_REMUS_MAX_WORKERS` environment variable to "0"
— so that the maximum number of workers the server will start is 0.
Started this way, the server will accept jobs but not have any available
......@@ -33,6 +33,6 @@ to run properly,
-root=/path/to/root -site=ctest
will start a worker that can respond to requests
made by the unitRemusBridgeConnection test.
made by the integrationRemoteSession test.
*
......@@ -9,11 +9,11 @@
#include "smtk/attribute/IntItem.h"
#include "smtk/attribute/ModelEntityItem.h"
#include "smtk/model/Bridge.h"
#include "smtk/model/DefaultBridge.h"
#include "smtk/model/GroupEntity.h"
#include "smtk/model/Session.h"