HOWTO: Write Multi domain Variables - fmihpc/vlsv GitHub Wiki
VLSV file format accepts all types of variables. Variables are defined as tuples that exist of all zones in the domain. VisIt, however, only supports scalars (tuple size 1), vectors (tuple size 2 or 3), and tensors (tuple size 9). Variable data must be written in the same order as zones were written to array MESH above. Variables are written to arrays called VARIABLE. Example below shows how to write a three-component vector variable to VLSV file:
// Copy variable data to temporary buffer:
int arraySize=<<number of local zones in domain>>;
int vectorSize=3;
double* buffer = new double[arraySize*vectorSize];
int localID=0;
for all local zones z {
for (i=0; i<vectorSize; ++i) {
buffer[localID*vectorSize+i] = <<value of i:th component of vector in zone z>>
}
++localID;
}
// Write buffer to file:
map<string,string> xmlAttributes;
xmlAttributes["mesh"]=<<name of your variable>>;
xmlAttributes["mesh"]=<<name of your mesh>>;
bool success=vlsv.writeArray("VARIABLE",xmlAttributes,arraySize,vectorSize,buffer);
delete [] buffer;
Rationale: each domain only writes variable data on its local zones. Plugin uses MESH_GHOST_DOMAINS and MESH_GHOST_LOCALIDS arrays to fetch values to domain's ghost zones.
Following XML attributes are supported:
| Attribute name | Mandatory or optional? | Accepted values | Value datatype | | mesh | mandatory | Mesh in which variable belongs | string | | name | mandatory | Variable name | string |