8000 generate_corners() does not work for "mixed" unstructured topology. · Issue #1429 · LLNL/conduit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
generate_corners() does not work for "mixed" unstructured topology. #1429
Open
@BradWhitlock

Description

@BradWhitlock

generate_corners() uses the ShapeType and ShapeCascade classes to help figure out how to decompose the mesh into faces/edges/points. When you give "mixed" to ShapeType, it initializes with -1 for dims and other fields. This crashes later on in ShapeCascade when attempting to use dims as an array index.

  • For ShapeType(Node &topo), we can set dims to something sensible by examining the shape_map
  • For ShapeType(std::string &), we can't do anything better than dims=-1.
  • ShapeCascade for mixed doesn't make a lot of sense since the dimension 2,3 shapes depend on which shape of N elements is being considered
  • TopologyMetadata has special paths for polygonal meshes and for polyhedra. It probably needs special paths for mixed, or it needs to treat 3D mixed as polyhedral and 2D mixed as polygonal.
#include <conduit_node.hpp>
#include <conduit_relay_io.hpp>
#include <conduit_relay_io_blueprint.hpp>
#include <conduit_blueprint_mesh.hpp>
#include <conduit_blueprint_mesh_utils.hpp>

#include <iostream>

void make_mixed(conduit::Node &mesh)
{
    const char *yaml = R"(
coordsets:
  coords:
    type: explicit
    values:
      x: [0., 1., 2., 3., 0., 2., 3., 0., 1., 2., 3.]
      y: [0., 0., 0., 0., 1., 1., 1., 2., 2., 2., 2.]
topologies:
  main:
    type: unstructured
    coordset: coords
    elements:
      shape: mixed
      connectivity: [4,8,7, 0,1,5,9,8,4, 1,2,3,6,5, 5,6,10,9]
      sizes: [3,6,5,4]
      offsets: [0,3,9,14]
      shapes: [0,2,2,1]
      shape_map:
        tri: 0
        quad: 1
        polygonal: 2
fields:
  area:
    association: element
    topology: main
    values: [0.5, 3., 1.5, 1.]
)";

    mesh.parse(yaml);
}

int
main(int argc, char *argv[])
{
    conduit::Node mesh;
    make_mixed(mesh);

    // Make corners
    conduit::Node &topo = mesh["topologies/main"];
    conduit::Node &coordset = mesh["coordsets/coords"];
    conduit::Node &corner_topo = mesh["topologies/corners"];
    conduit::Node &corner_coordset = mesh["coordsets/corner_coords"];
    conduit::Node d2s, s2d;
    conduit::blueprint::mesh::topology::unstructured::generate_corners(topo, corner_topo, corner_coordset, d2s, s2d);
    
    // Save.
    mesh.print();
    conduit::relay::io::blueprint::save_mesh(mesh, "mesh", "hdf5");

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0