FreeMat
vtkModelMetadata

Section: Visualization Toolkit Graphics Classes

Usage

This class is inspired by the Exodus II file format, but because this class does not depend on the Exodus library, it should be possible to use it to represent metadata for other dataset file formats. Sandia Labs uses it in their Exodus II reader, their Exodus II writer and their EnSight writer. vtkDistributedDataFilter looks for metadata attached to it's input and redistributes the metadata with the grid.

The fields in this class are those described in the document "EXODUS II: A Finite Element Data Model", SAND92-2137, November 1995.

Element and node IDs stored in this object must be global IDs, in the event that the original dataset was partitioned across many files.

One way to initialize this object is by using vtkExodusModel (a Sandia class used by the Sandia Exodus reader). That class will take an open Exodus II file and a vtkUnstructuredGrid drawn from it and will set the required fields.

Alternatively, you can use all the Set* methods to set the individual fields. This class does not copy the data, it simply uses your pointer. This class will free the storage associated with your pointer when the class is deleted. Most fields have sensible defaults. The only requirement is that if you are using this ModelMetadata to write out an Exodus or EnSight file in parallel, you must SetBlockIds and SetBlockIdArrayName. Your vtkUnstructuredGrid must have a cell array giving the block ID for each cell.

To create an instance of class vtkModelMetadata, simply invoke its constructor as follows

  obj = vtkModelMetadata

Methods

The class vtkModelMetadata has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, obj is an instance of the vtkModelMetadata class.

  • string = obj.GetClassName ()
  • int = obj.IsA (string name)
  • vtkModelMetadata = obj.NewInstance ()
  • vtkModelMetadata = obj.SafeDownCast (vtkObject o)
  • obj.PrintGlobalInformation ()
  • obj.PrintLocalInformation ()
  • obj.SetTitle (string ) - The title of the dataset.
  • obj.AddInformationLine (string info) - Add an information line.
  • obj.AddQARecord (string name, string version, string date, string time) - Add a QA record. They fields are: The code name The code version number The date (MM/DD/YY or NULL for today) The time (HH:MM:SS or NULL for right now)
  • obj.SetTimeStepIndex (int ) - Set the index of the time step represented by the results data in the file attached to this ModelMetadata object. Time step indices start at 0 in this file, they start at 1 in an Exodus file.
  • obj.SetTimeSteps (int numberOfTimeSteps, float timeStepValues) - Set the total number of time steps in the file, and the value at each time step. We use your time step value array and delete it when we're done.
  • obj.SetNumberOfBlocks (int ) - The number of blocks in the file. Set this before setting any of the block arrays.
  • obj.SetBlockIds (int ) - An arbitrary integer ID for each block. We use your pointer, and free the memory when the object is freed.
  • int = obj.SetBlockNumberOfElements (int nelts) - Set or get a pointer to a list of the number of elements in each block. We use your pointers, and free the memory when the object is freed.
  • obj.SetBlockNodesPerElement (int ) - Set or get a pointer to a list of the number of nodes in the elements of each block. We use your pointers, and free the memory when the object is freed.
  • obj.SetBlockElementIdList (int ) - Set or get a pointer to a list global element IDs for the elements in each block. We use your pointers, and free the memory when the object is freed.
  • int = obj.SetBlockNumberOfAttributesPerElement (int natts) - Set or get a pointer to a list of the number of attributes stored for the elements in each block. We use your pointers, and free the memory when the object is freed.
  • obj.SetBlockAttributes (float ) - Set or get a pointer to a list of the attributes for all blocks. The order of the list should be by block, by element within the block, by attribute. Omit blocks that don't have element attributes.
  • obj.SetNumberOfNodeSets (int ) - The number of node sets in the file. Set this value before setting the various node set arrays.
  • obj.SetNodeSetIds (int ) - Set or get the list the IDs for each node set. Length of list is the number of node sets. We use your pointer, and free the memory when the object is freed.
  • int = obj.SetNodeSetSize (int ) - Set or get a pointer to a list of the number of nodes in each node set. We use your pointer, and free the memory when the object is freed.
  • obj.SetNodeSetNodeIdList (int ) - Set or get a pointer to a concatenated list of the IDs of all nodes in each node set. First list all IDs in node set 0, then all IDs in node set 1, and so on. We use your pointer, and free the memory when the object is freed.
  • int = obj.SetNodeSetNumberOfDistributionFactors (int ) - Set or get a list of the number of distribution factors stored by each node set. This is either 0 or equal to the number of nodes in the node set. Length of list is number of node sets. We use your pointer, and free the memory when the object is freed.
  • obj.SetNodeSetDistributionFactors (float ) - Set or get a list of the distribution factors for the node sets. The list is organized by node set, and within node set by node. We use your pointer, and free the memory when the object is freed.
  • obj.SetNumberOfSideSets (int ) - Set or get the number of side sets. Set this value before setting any of the other side set arrays.
  • obj.SetSideSetIds (int ) - Set or get a pointer to a list giving the ID of each side set. We use your pointer, and free the memory when the object is freed.
  • int = obj.SetSideSetSize (int sizes) - Set or get a pointer to a list of the number of sides in each side set. We use your pointer, and free the memory when the object is freed.
  • int = obj.SetSideSetNumberOfDistributionFactors (int df) - Set or get a pointer to a list of the number of distribution factors stored by each side set. Each side set has either no distribution factors, or 1 per node in the side set. We use your pointer, and free the memory when the object is freed.
  • obj.SetSideSetElementList (int ) - Set or get a pointer to a list of the elements containing each side in each side set. The list is organized by side set, and within side set by element. We use your pointer, and free the memory when the object is freed.
  • obj.SetSideSetSideList (int ) - Set or get a pointer to the element side for each side in the side set. (See the manual for the convention for numbering sides in different types of cells.) Side Ids are arranged by side set and within side set by side, and correspond to the SideSetElementList. We use your pointer, and free the memory when the object is freed.
  • obj.SetSideSetNumDFPerSide (int numNodes) - Set or get a pointer to a list of the number of nodes in each side of each side set. This list is organized by side set, and within side set by side. We use your pointer, and free the memory when the object is freed.
  • obj.SetSideSetDistributionFactors (float ) - Set or get a pointer to a list of all the distribution factors. For every side set that has distribution factors, the number of factors per node was given in the SideSetNumberOfDistributionFactors array. If this number for a given side set is N, then for that side set we have N floating point values for each node for each side in the side set. If nodes are repeated in more than one side, we repeat the distribution factors. So this list is in order by side set, by node. We use your pointer, and free the memory when the object is freed.
  • obj.SetBlockPropertyValue (int ) - Set or get value for each variable for each block. List the integer values in order by variable and within variable by block.
  • obj.SetNodeSetPropertyValue (int ) - Set or get value for each variable for each node set. List the integer values in order by variable and within variable by node set.
  • obj.SetSideSetPropertyValue (int ) - Set or get value for each variable for each side set. List the integer values in order by variable and within variable by side set.
  • obj.SetGlobalVariableValue (float f) - Set or get the values of the global variables at the current time step.
  • obj.SetElementVariableTruthTable (int ) - A truth table indicating which element variables are defined for which blocks. The variables are all the original element variables that were in the file. The table is by block ID and within block ID by variable.
  • obj.SetAllVariablesDefinedInAllBlocks (int ) - Instead of a truth table of all "1"s, you can set this instance variable to indicate that all variables are defined in all blocks.
  • obj.AllVariablesDefinedInAllBlocksOn () - Instead of a truth table of all "1"s, you can set this instance variable to indicate that all variables are defined in all blocks.
  • obj.AllVariablesDefinedInAllBlocksOff () - Instead of a truth table of all "1"s, you can set this instance variable to indicate that all variables are defined in all blocks.
  • int = obj.ElementVariableIsDefinedInBlock (string varname, int blockId) - If the element variable named is defined for the block Id provided (in the element variable truth table) return a 1, otherwise return a 0. If the variable name or block Id are unrecognized, the default value of 1 is returned. (This is an "original" variable name, from the file, not a name created for the vtkUnstructuredGrid. Use FindOriginal*VariableName to map between the two.)
  • string = obj.FindOriginalElementVariableName (string name, int component) - Given the name of an element variable the vtkUnstructuredGrid described by this ModelMetadata, and a component number, give the name of the scalar array in the original file that turned into that component when the file was read into VTK.
  • string = obj.FindOriginalNodeVariableName (string name, int component) - Given the name of an node variable the vtkUnstructuredGrid described by this ModelMetadata, and a component number, give the name of the scalar array in the original file that turned into that component when the file was read into VTK.
  • obj.Pack (vtkDataSet ugrid) - Pack this object's metadata into a field array of a dataset.
  • int = obj.Unpack (vtkDataSet ugrid, int deleteIt) - Unpack the metadata stored in a dataset, and initialize this object with it. Return 1 if there's no metadata packed into the grid, 0 if OK. If deleteIt is ON, then delete the grid's packed data after unpacking it into the object.
  • int = obj.AddUGridElementVariable (string ugridVarName, string origName, int numComponents) - In order to write Exodus files from vtkUnstructuredGrid objects that were read from Exodus files, we need to know the mapping from variable names in the UGrid to variable names in the Exodus file. (The Exodus reader combines scalar variables with similar names into vectors in the UGrid.) When building the UGrid to which this ModelMetadata refers, add each element and node variable name with this call, including the name of original variable that yielded it's first component, and the number of components. If a variable is removed from the UGrid, remove it from the ModelMetadata. (If this information is missing or incomplete, the ExodusIIWriter can still do something sensible in creating names for variables.)
  • int = obj.RemoveUGridElementVariable (string ugridVarName) - In order to write Exodus files from vtkUnstructuredGrid objects that were read from Exodus files, we need to know the mapping from variable names in the UGrid to variable names in the Exodus file. (The Exodus reader combines scalar variables with similar names into vectors in the UGrid.) When building the UGrid to which this ModelMetadata refers, add each element and node variable name with this call, including the name of original variable that yielded it's first component, and the number of components. If a variable is removed from the UGrid, remove it from the ModelMetadata. (If this information is missing or incomplete, the ExodusIIWriter can still do something sensible in creating names for variables.)
  • int = obj.AddUGridNodeVariable (string ugridVarName, string origName, int numComponents)
  • int = obj.RemoveUGridNodeVariable (string ugridVarName)
  • int = obj.MergeModelMetadata (vtkModelMetadata em) - In VTK we take vtkUnstructuredGrids and perform operations on them, including subsetting and merging grids. We need to modify the metadata object when this happens. MergeModelMetadata merges the supplied model (both global and local metadata) into this model. The models must be from the same file set.

    MergeModelMetadata assumes that no element in one metadata object appears in the other. (It doesn't test for duplicate elements when merging the two metadata objects.)

  • int = obj.MergeGlobalInformation (vtkModelMetadata em) - The metadata is divided into global metadata and local metadata. MergeGlobalInformation merges just the global metadata of the supplied object into the global metadata of this object.
  • vtkModelMetadata = obj.ExtractModelMetadata (vtkIdTypeArray globalCellIdList, vtkDataSet grid) - Create and return a new metadata object which contains the information for the subset of global cell IDs provided. We need the grid containing the cells so we can find point Ids as well, and also the name of the global cell ID array and the name of the global point ID array.
  • vtkModelMetadata = obj.ExtractGlobalMetadata () - Create and return a new metadata object containing only the global metadata of this metadata object.
  • obj.FreeAllGlobalData () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeAllLocalData () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeBlockDependentData () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeOriginalElementVariableNames () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeOriginalNodeVariableNames () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeUsedElementVariableNames () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeUsedNodeVariableNames () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeUsedElementVariables () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.FreeUsedNodeVariables () - Free selected portions of the metadata when updating values in the vtkModelMetadata object. Resetting a particular field, (i.e. SetNodeSetIds) frees the previous setting, but if you are not setting every field, you may want to do a wholesale "Free" first.

    FreeAllGlobalData frees all the fields which don't depend on which time step, which blocks, or which variables are in the input. FreeAllLocalData frees all the fields which do depend on which time step, blocks or variables are in the input. FreeBlockDependentData frees all metadata fields which depend on which blocks were read in.

  • obj.Reset () - Set the object back to it's initial state
  • int = obj.GetBlockLocalIndex (int id) - Block information is stored in arrays. This method returns the array index for a given block ID.