writeh3ddata
Writes data in an H3D file.
Syntax
R = writeh3ddata(fid, subcase, simulation, datatype, layer, corners, entities, data[,pool])
Inputs
- fid
- Integer representing the file ID, returned from createh3dfile().
- subcase
- Subcase name or ID.
- simulation
- Simulation index (starting from 1). The simulation index can be defined as starting from 1 to length(timestep), not the timestep itself (who can start from 0.0).
- datatype
- Datatype name or ID.
- layer
- Layer name or ID. Can be zero.
- corners
- Write corner data (0=no , 1=yes).
- entities
- Matrix with entities IDs.
- data
- List of data to be added for each entity. The size of the matrix must be of numberofentities x numberofcomponents.
Example
writeh3ddata(idx, 'Subcase 2', 1, 'DT scalar node:nolayer nocorner', 0, 0, nodes, 2*nodes)
Create an H3D file which contains one subcase, with one data type containing two components:
resultFile = 'testfile.h3d';
% Entities
nodes = [1:32];
elems2D = [20 24 27 31 36 39 42 43 47];
elems3D = [10:18];
lsnd = [1:length(nodes)]';
ls2d = [1:length(elems2D)]';
ls3d = [1:length(elems3D)]';
tensor2d2d = [ls2d ls2d*2 ls2d*3];
tensor2d3d = [ls2d ls2d*2 zeros(length(elems2D), 1) ls2d zeros(length(elems2D), 1) zeros(length(elems2D), 1)];
tensor3d3d = [ls3d ; ls3d*2 ; ls3d*3 ; ls3d ; ls3d*2 ; ls3d*3];
idx = cw_h3d_createFile(resultFile, 'append')
lidx1 = cw_h3d_createLayer(idx, 'Layer 1');
lidx2 = cw_h3d_createLayer(idx, 'Layer 2');
pidx1 = cw_h3d_createPool(idx, '2D');
pidx2 = cw_h3d_createPool(idx, '3D');
tidx1 = cw_h3d_createDatatype(idx, 'Element Stresses', '3Dtensor', 'elem', 'pools', [pidx1 pidx2], 'layers', [lidx1 lidx2]);
sidx1 = cw_h3d_createSubcase(idx, 'Subcase 2', {'SC2 Iteration 1' 'SC2 Iteration 2'}, [0.0 1.0]);
cw_h3d_writeData(idx, sidx1, 1, tidx1, 1, 0, elems2D, tensor2d3d, pidx1);
cw_h3d_writeData(idx, sidx1, 1, tidx1, 2, 0, elems2D, 2*tensor2d3d, pidx1);
cw_h3d_writeData(idx, sidx1, 1, tidx1, 0, 0, elems3D, tensor3d3d, pidx2);
cw_h3d_writeData(idx, sidx1, 2, tidx1, 1, 0, elems2D, tensor2d3d, pidx1);
cw_h3d_writeData(idx, sidx1, 2, tidx1, 2, 0, elems2D, 2*tensor2d3d, pidx1);
cw_h3d_writeData(idx, sidx1, 2, tidx1, 0, 0, elems3D, tensor3d3d, pidx2);
% Close file
cw_h3d_closeH3DFile(idx);
Comments
- Layer definition (if required).
- Datatype definition (needs the layer definition if it exists).
- Subcase definition (needs the datatype definition).
- Data write (needs the subcase, datatype, and layer (if it exists) definitions).