Contents     Functions         Previous Next     PDF Index

of2vtk

Purpose

Export model and deformations to VTK format for visualization purposes.

Syntax

opfem2VTK(FileName,model)
opfem2VTK(FileName,model,val1,...,valn)

Description

Simple function to write the mesh corresponding to the structure model and associated data currently in the “Legacy VTK file format” for visualization.

To visualize the mesh using VTK files you may use ParaView which is freely available
at http://www.paraview.org or any other visualization software supporting VTK file formats.

try;tname=nas2up('tempname.vtk');catch;tname=[tempname '.vtk'];end
model=femesh('testquad4');

NodeData1.Name='NodeData1';NodeData1.Data=[1 ; 2 ; 3 ; 4];
NodeData2.Name='NodeData2';NodeData2.Data=[0 0 1;0 0 2;0 0 3;0 0 4];
of2vtk('fic1',model,NodeData1,NodeData2);

EltData1.Name ='EltData1' ;EltData1.Data =[ 1 ];
EltData2.Name ='EltData2' ;EltData2.Data =[ 1 2 3];
of2vtk('fic2',model,EltData1,EltData2);

def.def = [0 0 1 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 0 4 0 0 0 ]'*[1 2]; 
def.DOF=reshape(repmat((1:4),6,1)+repmat((1:6)'/100,1,4),[],1)
def.lab={'NodeData3','NodeData4'};
of2vtk('fic3',model,def);

EltData3.EltId=[1];EltData3.data=[1];EltData3.lab={'EltData3'};
EltData4.EltId=[2];EltData4.data=[2];EltData4.lab={'EltData4'};
of2vtk('fic4',model,EltData3,EltData4);

The default extention .vtk is added if no extention is given.

Input arguments are the following:

FileName

file name for the VTK output, no extension must be given in FileName, “FileName.vtk” is automatically created.

model

a structure defining the model. It must contain at least fields .Node and .Elt.
FileName and model fields are mandatory.

vali

To create a VTK file defining the mesh and some data at nodes/elements (scalars, vectors) you want to visualize, you must specify as many inputs vali as needed. vali is a structure defining the data: vali=struct(′Name′,ValueName,′Data′,Values). Values can be either a table of scalars (Nnode × 1 or Nelt × 1) or vectors (Nnode × 3 or Nelt × 3) at nodes/elements. Note that a deformed model can be visualized by providing nodal displacements as data (e.g. in ParaView using the “warp” function).


©1991-2019 by SDTools
Previous Up Next