Many simulation meshes are decomposed into different "domains", which are smaller pieces of the mesh that get mapped to different processors when running in parallel. Some applications like to also group related domains into higher level constructs. VisIt calls these collections of domains groups, though other codes will sometimes call them blocks. Groups of domains are usually members of a single i,j,k index space where each domain is offset in that space using a base index.

DomainBoundaries domains.png DomainBoundaries groups.png
Subset plot of domains. Subset plot of groups.
(group 0 = domains 0,1
group 1 = domains 2,3
group 2 = domains 4,5)

Specifying groups

In order to tell VisIt that your mesh has multiple groups, you must set the group information in the mesh metadata. Mesh metadata is initialized in the PopulateDatabaseMetaData method of a database reader plugin or the GetMetaData callback function that you register with libsim when you are instrumenting a simulation.

  1. Set the numGroups member in the mesh metadata. This will create a set of groups with indices [0,nGroups-1].
  2. Set the groupIds member in the mesh metadata. This is a vector of integers (1 per domain) that indicates the parent group of the domain. The group value must be in [0,nGroups-1].
  3. Set the groupTitle member in the mesh metadata. (optional)
  4. Set the groupPieceName member in the mesh metadata. (optional)
#define NBLOCKS 3
#define NDOMAINS 6

/* Which block/group each domain lives in. */
int block_id[NDOMAINS] = {0, 0, 1, 1, 2, 2};

SimGetMetaData(void *cbdata)
    visit_handle md = VISIT_INVALID_HANDLE;

    /* Create metadata. */
    if(VisIt_SimulationMetaData_alloc(&md) == VISIT_OKAY)
        int i;
        visit_handle mmd = VISIT_INVALID_HANDLE;

        /* Add mesh metadata. */
        if(VisIt_MeshMetaData_alloc(&mmd) == VISIT_OKAY)
            /* Set the mesh's properties.*/
            VisIt_MeshMetaData_setName(mmd, "mesh2d");
            VisIt_MeshMetaData_setMeshType(mmd, VISIT_MESHTYPE_CURVILINEAR);
            VisIt_MeshMetaData_setTopologicalDimension(mmd, 2);
            VisIt_MeshMetaData_setSpatialDimension(mmd, 2);
            VisIt_MeshMetaData_setNumDomains(mmd, NDOMAINS);
            VisIt_MeshMetaData_setDomainTitle(mmd, "Domains");
            VisIt_MeshMetaData_setDomainPieceName(mmd, "domain");

            /* This code here tells VisIt how domains are grouped. */
            VisIt_MeshMetaData_setNumGroups(mmd, NBLOCKS);
            VisIt_MeshMetaData_setGroupTitle(mmd, "Blocks");
            VisIt_MeshMetaData_setGroupPieceName(mmd, "block");
            for(i = 0; i < NDOMAINS; ++i)
                VisIt_MeshMetaData_addGroupId(mmd, block_id[i]);

            VisIt_SimulationMetaData_addMesh(md, mmd);

    return md;