Commit 7d79dd60 authored by ahern's avatar ahern

Added a bit of C code showing how to write out a simple rectilinear mesh with

two scalars.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@2674 18c085ea-50e0-402c-830e-de6fd14e8384
parent 1614413c
#include "visit_writer.h"
#include <math.h>
int
main(int argc, char **argv)
{
// Set up storage
int nCellsX = 10;
int nCellsY = 10;
float cellCentered[nCellsX][nCellsY];
float nodeCentered[nCellsX+1][nCellsY+1];
// Put data in the arrays.
int x, y;
for(x=0;x<nCellsX;x++)
for(y=0;y<nCellsY;y++)
cellCentered[x][y] = sin(x/2.)*cos(y/2.);
for(x=0;x<nCellsX+1;x++)
for(y=0;y<nCellsY+1;y++)
nodeCentered[x][y] = 1/(x*y+0.1);
// Write out the mesh and the arrays.
int dims[] = { nCellsX+1, nCellsY+1, 1 }; // The number of nodes in the mesh.
int vardims[] = { 1, 1 }; // Two scalars
int centering[] = { 1, 0 }; // node centered, cell centered
const char * const varnames[] = { "nodeCentered", "cellCentered" };
float *arrays[] = { (float*)nodeCentered, (float*)cellCentered };
write_regular_mesh("example.vtk", 0, dims, 2, vardims, centering,
varnames, arrays);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment