IFEM  90A354
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
VTF Class Reference

Class for output of FE model and results to VTF file. More...

#include <VTF.h>

Collaboration diagram for VTF:
Collaboration graph
[legend]

Public Member Functions

 VTF (const char *filename, int type)
 The constructor opens a new VTF-file. More...
 
 VTF (const VTF &)=delete
 No copying of this class.
 
 ~VTF ()
 The destructor finalizes and closes the VTF-file.
 
bool writeGrid (const ElementBlock *block, const char *gName, int elemID, int nodeID=0)
 Writes the FE geometry to the VTF-file. More...
 
bool writeTransformation (const Vec3 &X, const Tensor &T, int idBlock=1, int gID=1)
 Writes a transformation matrix to the VTF-file. More...
 
bool writeNres (const std::vector< Real > &nodalResult, int idBlock=1, int geomID=1)
 Writes a block of scalar nodal results to the VTF-file. More...
 
bool writeEres (const std::vector< Real > &elementResult, int idBlock=1, int geomID=1)
 Writes a block of scalar element results to the VTF-file. More...
 
bool writeVres (const std::vector< Real > &nodeResult, int idBlock=1, int geomID=1, size_t nvc=0)
 Writes a block of vector nodal results to the VTF-file. More...
 
bool writeNfunc (const RealFunc &f, const Real *u=nullptr, Real time=Real(0), int idBlock=1, int gID=1)
 Writes a block of scalar nodal function values to the VTF-file. More...
 
bool writeVectors (const std::vector< Vec3Pair > &pntResult, int &gID, int idBlock=1, const char *resultName=nullptr, int iStep=0, int iBlock=1)
 Writes a block of point vector results to the VTF-file. More...
 
bool writePoints (const std::vector< Vec3 > &points, int &gID)
 Writes a block of points (no results) to the VTF-file. More...
 
bool writeSblk (int sBlockID, const char *resultName=nullptr, int idBlock=1, int iStep=1, bool elementData=false)
 Writes a scalar block definition to the VTF-file. More...
 
bool writeSblk (const std::vector< int > &sBlockIDs, const char *resultName=nullptr, int idBlock=1, int iStep=1, bool elementData=false)
 Writes a scalar block definition to the VTF-file. More...
 
bool writeVblk (int vBlockID, const char *resultName=nullptr, int idBlock=1, int iStep=1)
 Writes a vector block definition to the VTF-file. More...
 
bool writeVblk (const std::vector< int > &vBlockIDs, const char *resultName=nullptr, int idBlock=1, int iStep=1)
 Writes a vector block definition to the VTF-file. More...
 
bool writeDblk (const std::vector< int > &dBlockIDs, const char *resultName=nullptr, int idBlock=1, int iStep=1)
 Writes a displacement block definition to the VTF-file. More...
 
bool writeTblk (const std::vector< int > &tBlockIDs, const char *resultName=nullptr, int idBlock=1, int iStep=1)
 Writes a transformation block definition to the VTF-file. More...
 
bool writeState (int iStep, const char *fmt, Real refValue, int refType=0)
 Writes a state info block to the VTF-file. More...
 
const ElementBlockgetBlock (int geomID) const
 Returns the pointer to a geometry block.
 
int getNodeBlock (int geomID) const
 Returns the node block ID associated with a geometry block.
 
void writeGeometryBlocks (int iStep)
 Adds the current FE geometry blocks to the description block.
 
void clearGeometryBlocks ()
 Drops the current FE geometry blocks.
 

Static Public Attributes

static Real vecOffset [3] = { 0.0, 0.0, 0.0 }
 Optional offset for vector attack points.
 

Private Member Functions

bool writeNodes (int iBlockID)
 Writes a node block to the VTF-file. More...
 
bool writeElements (const char *partName, int partID, int iBlockID, int iNodeBlockID)
 Writes an element block to the VTF-file. More...
 

Private Attributes

VTFAFile * myFile
 Pointer to the actual VTF-file being written.
 
VTFAStateInfoBlock * myState
 The state info block for this file.
 
VTFAGeometryBlock * myGBlock
 The geometry description block for this file.
 
std::vector< VTFATransformationBlock * > myTBlock
 Transformation blocks.
 
std::vector< VTFADisplacementBlock * > myDBlock
 Displacement blocks.
 
std::vector< VTFAVectorBlock * > myVBlock
 Vector field blocks.
 
std::vector< VTFAScalarBlock * > mySBlock
 Scalar field blocks.
 
int myPartID
 Internal geometry block part ID.
 
int pointGeoID
 ID of point vector geometry block.
 
int lastStep
 ID of the last state written to file.
 
std::vector< GridBlockmyBlocks
 The FE geometry of the whole model.
 

Detailed Description

Class for output of FE model and results to VTF file.

Constructor & Destructor Documentation

◆ VTF()

VTF::VTF ( const char *  filename,
int  type 
)

The constructor opens a new VTF-file.

Parameters
[in]filenameName of the VTF-file
[in]typeFile type (0 = ASCII, 1 = BINARY)

References lastStep, myFile, myGBlock, myPartID, myState, pointGeoID, showError(), and VTFA_FAILURE.

Member Function Documentation

◆ writeDblk()

bool VTF::writeDblk ( const std::vector< int > &  dBlockIDs,
const char *  resultName = nullptr,
int  idBlock = 1,
int  iStep = 1 
)

Writes a displacement block definition to the VTF-file.

Parameters
[in]dBlockIDsAll result blocks that make up the displacement block
[in]resultNameName of the result quantity
[in]idBlockDisplacement block identifier
[in]iStepLoad/Time step identifier

References myDBlock, showError(), VTFA_FAILURE, and VTFA_SUCCESS.

Referenced by SIMoutput::writeGlvM(), and SIMoutput::writeGlvS1().

◆ writeElements()

bool VTF::writeElements ( const char *  partName,
int  partID,
int  iBlockID,
int  iNodeBlockID 
)
private

Writes an element block to the VTF-file.

The element topology of the last added element block is written.

Parameters
[in]partNameName used to identify the part in GLview
[in]partIDPart identifier
[in]iBlockIDElement block identifier
[in]iNodeBlockIDNode block which the element block refers to

References ElementBlock::getElements(), ElementBlock::getNoElmNodes(), ElementBlock::getNoElms(), myBlocks, myFile, VTFA_FAILURE, and VTFA_SUCCESS.

Referenced by writeGrid().

◆ writeEres()

bool VTF::writeEres ( const std::vector< Real > &  elementResult,
int  idBlock = 1,
int  geomID = 1 
)

Writes a block of scalar element results to the VTF-file.

Parameters
[in]elementResultVector of element results (one per element) length must equal the number of elements in the geometry block
[in]idBlockResult block identifier
[in]geomIDGeometry block identifier

If elementResult is empty, the external element numbers will instead define the scalar field to be written.

References getBlock(), ElementBlock::getElmId(), ElementBlock::getElmIndex(), ElementBlock::getNoElms(), myBlocks, myFile, showError(), and VTFA_FAILURE.

Referenced by SIMoutput::writeGlvE(), and SIMoutput::writeGlvN().

◆ writeGrid()

bool VTF::writeGrid ( const ElementBlock block,
const char *  gName,
int  elemID,
int  nodeID = 0 
)

Writes the FE geometry to the VTF-file.

Parameters
[in]blockThe FE grid that all results written are referred to
[in]gNameName of the geometry being written
[in]elemIDElement block identifier
[in]nodeIDOptional node block identifier (equal to elemID if 0)

References myBlocks, myFile, myPartID, showError(), writeElements(), and writeNodes().

Referenced by SIMoutput::writeGlvG().

◆ writeNfunc()

bool VTF::writeNfunc ( const RealFunc f,
const Real u = nullptr,
Real  time = Real(0),
int  idBlock = 1,
int  gID = 1 
)

Writes a block of scalar nodal function values to the VTF-file.

Parameters
[in]fThe scalar function to evaluate at the grid points
[in]uPointer to array of solution state values
[in]timeCurrent time
[in]idBlockResult block identifier
[in]gIDGeometry block identifier

References getBlock(), ElementBlock::getCoord(), ElementBlock::getNoNodes(), ElementBlock::getParam(), myBlocks, myFile, showError(), and VTFA_FAILURE.

Referenced by SIMoutput::writeGlvF().

◆ writeNodes()

bool VTF::writeNodes ( int  iBlockID)
private

Writes a node block to the VTF-file.

The coordinates of the last added element block are written.

Parameters
[in]iBlockIDNode block identifier

References ElementBlock::begin_XYZ(), ElementBlock::end_XYZ(), ElementBlock::getNoNodes(), myBlocks, myFile, and VTFA_FAILURE.

Referenced by writeGrid().

◆ writeNres()

bool VTF::writeNres ( const std::vector< Real > &  nodalResult,
int  idBlock = 1,
int  geomID = 1 
)

Writes a block of scalar nodal results to the VTF-file.

Parameters
[in]nodalResultVector of nodal results, length must equal the number of nodes in the geometry block
[in]idBlockResult block identifier
[in]geomIDGeometry block identifier

References getBlock(), ElementBlock::getNoNodes(), myBlocks, myFile, showError(), and VTFA_FAILURE.

Referenced by SIMoutput::writeGlvBC(), SIMoutput::writeGlvS(), and SIMoutput::writeScalarFields().

◆ writePoints()

bool VTF::writePoints ( const std::vector< Vec3 > &  points,
int &  gID 
)

Writes a block of points (no results) to the VTF-file.

Parameters
[in]pointsVector of point coordinates
gIDRunning geometry block identifier

References myBlocks, myFile, myPartID, showError(), vecOffset, and VTFA_FAILURE.

Referenced by writeVectors().

◆ writeSblk() [1/2]

bool VTF::writeSblk ( const std::vector< int > &  sBlockIDs,
const char *  resultName = nullptr,
int  idBlock = 1,
int  iStep = 1,
bool  elementData = false 
)

Writes a scalar block definition to the VTF-file.

Parameters
[in]sBlockIDsAll result blocks that make up this scalar block
[in]resultNameName of the result quantity
[in]idBlockScalar block identifier
[in]iStepLoad/Time step identifier
[in]elementDatafalse -> data per node, true -> data per element

References mySBlock, showError(), VTFA_FAILURE, and VTFA_SUCCESS.

◆ writeSblk() [2/2]

bool VTF::writeSblk ( int  sBlockID,
const char *  resultName = nullptr,
int  idBlock = 1,
int  iStep = 1,
bool  elementData = false 
)

Writes a scalar block definition to the VTF-file.

Parameters
[in]sBlockIDThe result block that makes up this scalar block
[in]resultNameName of the result quantity
[in]idBlockScalar block identifier
[in]iStepLoad/Time step identifier
[in]elementDatafalse -> data per node, true -> data per element

References mySBlock, showError(), and VTFA_FAILURE.

Referenced by SIMoutput::writeGlvBC(), SIMoutput::writeGlvE(), SIMoutput::writeGlvF(), SIMoutput::writeGlvN(), SIMoutput::writeGlvP(), SIMoutput::writeGlvS(), SIMoutput::writeGlvS1(), and SIMoutput::writeGlvS2().

◆ writeState()

bool VTF::writeState ( int  iStep,
const char *  fmt,
Real  refValue,
int  refType = 0 
)

Writes a state info block to the VTF-file.

Parameters
[in]iStepLoad/Time step identifier
[in]fmtFormat string for step name
[in]refValueReference value for the step (time, frequency, etc.)
[in]refTypeReference value type (0=Time, 1=Frequency, 2=Load case)

References lastStep, myState, showError(), and VTFA_FAILURE.

Referenced by SIMoutput::writeGlvM(), and SIMoutput::writeGlvStep().

◆ writeTblk()

bool VTF::writeTblk ( const std::vector< int > &  tBlockIDs,
const char *  resultName = nullptr,
int  idBlock = 1,
int  iStep = 1 
)

Writes a transformation block definition to the VTF-file.

Parameters
[in]tBlockIDsAll result blocks that make the transformation block
[in]resultNameName of the result quantity
[in]idBlockTransformation block identifier
[in]iStepLoad/Time step identifier

References myTBlock, showError(), VTFA_FAILURE, and VTFA_SUCCESS.

◆ writeTransformation()

bool VTF::writeTransformation ( const Vec3 X,
const Tensor T,
int  idBlock = 1,
int  gID = 1 
)

Writes a transformation matrix to the VTF-file.

Parameters
[in]XPosition part of the transformation
[in]TOrientation part of the transformation
[in]idBlockResult block identifier
[in]gIDGeometry block identifier

References getBlock(), myBlocks, myFile, showError(), and VTFA_FAILURE.

◆ writeVblk() [1/2]

bool VTF::writeVblk ( const std::vector< int > &  vBlockIDs,
const char *  resultName = nullptr,
int  idBlock = 1,
int  iStep = 1 
)

Writes a vector block definition to the VTF-file.

Parameters
[in]vBlockIDsAll result blocks that make up this vector block
[in]resultNameName of the result quantity
[in]idBlockVector block identifier
[in]iStepLoad/Time step identifier

References myVBlock, showError(), VTFA_FAILURE, and VTFA_SUCCESS.

◆ writeVblk() [2/2]

bool VTF::writeVblk ( int  vBlockID,
const char *  resultName = nullptr,
int  idBlock = 1,
int  iStep = 1 
)

Writes a vector block definition to the VTF-file.

Parameters
[in]vBlockIDThe result block that makes up this vector block
[in]resultNameName of the result quantity
[in]idBlockVector block identifier
[in]iStepLoad/Time step identifier

References myVBlock, showError(), and VTFA_FAILURE.

Referenced by SIMoutput::writeGlvS1(), SIMoutput::writeGlvS2(), SIMoutput::writeGlvV(), and writeVectors().

◆ writeVectors()

bool VTF::writeVectors ( const std::vector< Vec3Pair > &  pntResult,
int &  gID,
int  idBlock = 1,
const char *  resultName = nullptr,
int  iStep = 0,
int  iBlock = 1 
)

Writes a block of point vector results to the VTF-file.

Parameters
[in]pntResultA set of result vectors with associated attack points
gIDRunning geometry block identifier
[in]idBlockResult block identifier
[in]resultNameName of the result quantity
[in]iStepLoad/Time step identifier
[in]iBlockVector block identifier

This method creates a separate geometry block consisting of the attack points of the result vectors, since they are independent of the FE geometry created by the writeGrid() method.

References myBlocks, myFile, myPartID, pointGeoID, showError(), vecOffset, VTFA_FAILURE, writePoints(), and writeVblk().

◆ writeVres()

bool VTF::writeVres ( const std::vector< Real > &  nodeResult,
int  idBlock = 1,
int  geomID = 1,
size_t  nvc = 0 
)

Writes a block of vector nodal results to the VTF-file.

Parameters
[in]nodeResultVector of nodal results, length must be equal the number of nodes in the geometry block times 1...5
[in]idBlockResult block identifier
[in]geomIDGeometry block identifier
[in]nvcNumber of components per node in nodeResult

References getBlock(), ElementBlock::getNoNodes(), myBlocks, myFile, showError(), and VTFA_FAILURE.

Referenced by SIMoutput::writeGlvM(), SIMoutput::writeGlvS1(), SIMoutput::writeGlvS2(), and SIMoutput::writeGlvV().


The documentation for this class was generated from the following files: