Skip to content

Commit

Permalink
Merge pull request #1167 from LLNL/feature/whitlock/conduit_tiled_exa…
Browse files Browse the repository at this point in the history
…mple

Create tiled mesh example function.
  • Loading branch information
BradWhitlock authored Sep 20, 2023
2 parents a6b0b17 + 7f8be28 commit 601d2cd
Show file tree
Hide file tree
Showing 25 changed files with 3,565 additions and 576 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s

#### General
- Added `conduit_json_external` protocol. Creates a json schema representation of a node that includes all addresses that the node is pointing to. Parsing this schema will create a node equivalent to `set_external()`.
- Added a `conduit_generate_data` executable that can generate datasets using the `tiled()` and `braid()` functions and save the datasets to files.

#### Relay
- Added ability to read N-dimensional hyperslabs from HDF5 leaf arrays into linear memory arrays.

#### Blueprint
- Added a `conduit::blueprint::mesh::examples::tiled()` function that can generate meshes by repeating a tiled pattern.
- Added a `conduit::blueprint::mpi::mesh::utils::adjset::compare_pointwise()` function that can compare adjsets for multi-domain meshes in parallel. The function is used to diagnose adjsets with points that are out of order on either side of the boundary. The comparison is done point by point within each group and it checks to ensure that the points reference the same spatial location.
- Added a `conduit::blueprint::mesh::utils::reorder()` function that can accept a vector of element ids and create a reordered topology. The points and coordinates are re-ordered according to their first use in the new element ordering.
- Added a `conduit::blueprint::mesh::utils::topology::spatial_ordering()` function that takes a topology and computes centroids for each element, passes them through a kdtree, and returns the new element ordering. The new ordering can be used with the `reorder()` function.
- Added a `conduit::blueprint::mesh::utils::slice_array()` function that can slice Conduit nodes that contain arrays. A new node with the same type is created but it contains only the selected indices.
- Added a `conduit::blueprint::mesh::utils::slice_field()` function. It is like `slice_array()` but it can handle the mcarray protocol. This functionality was generalized from the partitioner.

### Changed

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()
# Conduit
################################

project(conduit VERSION "0.8.8")
project(conduit VERSION "0.8.9")

################################
# Build Options
Expand Down
85 changes: 85 additions & 0 deletions src/docs/sphinx/blueprint_mesh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,91 @@ equal to half the number of prisms.

The resulting data is placed the Node ``res``, which is passed in via reference.


tiled
+++++++++

The ``tiled()`` function repeats a tile (given as a 2D Blueprint topology) into a larger mesh composed of
a regular square tiling of the supplied tile. If no topology is given, a default pattern consisting of quads
is used. The output mesh can be either 2D or 3D. For 3D, supply a ``nz`` parameter greater than zero. Note
that the input tile must consist of a homogeneous set of triangles or quads to extrude the tile into 3D since
polyhedral output is not yet supported. The ``tiled()`` function produces a single domain comprised of a
main mesh, a boundary mesh, and adjacency sets if the output mesh is to be part of a multi-domain dataset.

.. code:: cpp
conduit::blueprint::mesh::examples::tiled(index_t nx, // number of tiles along x
index_t ny, // number of tiles along y
index_t nz, // number of elements along z (0 for 2D)
conduit::Node &res, // result container
const conduit::Node &options);// options node
The ``tiled()`` function accepts a Conduit node containing options that influence how the mesh is generated.
If the options contain a ``tile`` node that contains a 2D blueprint topology, the first supplied topology will
be used to override the default tile pattern. The ``reorder`` option indicates the type of point and element
reordering that will be done. Reordering can improve cache-friendliness. The default is to reorder points
and elements, using "kdtree" method. Passing "none" or an empty string will prevent reordering.
The name of the mesh can be given by passing a ``meshname`` option string. Likewise, the name of the boundary
mesh can be supplied using the ``boundarymeshname`` option. The optional ``translate/x`` and ``translate/y``
options determine the tile spacing. If the translation values are not given, they will be determined from
the coordset extents. The output mesh topology will store its integer connectivity information as index_t
by default. The precision of the integer output can turned to int32 by passing a ``datatype`` option containing
the "int", "int32", "integer" strings.

An important set of options define the left, right, bottom, and top sets of points within the supplied tile
pattern. The values in the ``left`` option identify the list of points that define the left edge of the tile.
These are indices into the coordset and the values should be in consecutive order along the edge. Opposite point
sets must match. In other words, the left and right point sets must contain the same number of points and
they need to proceed along their edges in the same order. The same is true of the bottom and top point sets.

The ``tiled()`` function also accepts options that simplify the task of generating
mesh domains for a multi-domain dataset. The coordinate extents of the current mesh domain are given using
the ``extents`` option, which contains 6 double values: {xmin, xmax, ymin, ymax, zmin, zmax}. The ``domains``
option contains a triple of {domainsI, domainsJ, domainsK} values that indicate how many divisions there are
of the extents in the I,J,K dimensions. The product of these numbers determines the total number of domains.
The ``domain`` option specifies a triple indicating the I,J,K domain id within the overall set of domains.
This is used to help construct adjacency sets.

.. code:: yaml
# Define the tile topology
tile:
coordsets:
coords:
type: explicit
values:
x: [0., 1., 2., 0., 1., 2., 0., 1., 2.]
y: [0., 0.5, 0., 1., 1.5, 1., 2., 2.5, 2.]
topologies:
tile:
type: unstructured
coordset: coords
elements:
shape: tri
connectivity: [0,1,4, 0,4,3, 1,2,5, 1,5,4, 3,4,7, 3,7,6, 4,5,8, 4,8,7]
# Set some options that aid tiling.
reorder: 1
left: [0,3,6]
right: [2,5,8]
bottom: [0,1,2]
top: [6,7,8]
translate:
x: 2.
y: 2.
.. figure:: tiled_single.png
:width: 400px
:align: center

Pseudocolor plot of zoneid for default tile mesh that has been reordered.

.. figure:: tiled.png
:width: 600px
:align: center

Subset plots of multi-domain datasets created using the ``tiled()`` function.


miscellaneous
++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion src/docs/sphinx/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Contributors
- Mark Miller (LLNL)
- Todd Gamblin (LLNL)
- Kevin Huynh (LLNL)
- Brad Whitlock (Intelligent Light)
- Brad Whitlock (LLNL)
- Chris Laganella (Intelligent Light)
- George Aspesi (Harvey Mudd)
- Justin Bai (Harvey Mudd)
Expand Down
Binary file added src/docs/sphinx/tiled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/docs/sphinx/tiled_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/executables/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# other details. No copyright assignment is required to contribute to Conduit.

add_subdirectory(adjset_validate)
add_subdirectory(generate_data)
36 changes: 36 additions & 0 deletions src/executables/generate_data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to contribute to Conduit.

if(ENABLE_UTILS)
blt_add_executable(
NAME conduit_generate_data
SOURCES conduit_generate_data.cpp
OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS_ON conduit conduit_blueprint conduit_relay
FOLDER utils
)

# add install target
install(TARGETS conduit_generate_data
RUNTIME DESTINATION bin)

################################################################
# If we have mpi, add a parallel version.
################################################################

if(MPI_FOUND)
blt_add_executable(
NAME conduit_generate_data_mpi
SOURCES conduit_generate_data.cpp
OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}
DEFINES CONDUIT_PARALLEL
DEPENDS_ON conduit conduit_blueprint conduit_relay conduit_relay_mpi_io ${conduit_blt_mpi_deps}
FOLDER utils
)

# add install target
install(TARGETS conduit_generate_data_mpi
RUNTIME DESTINATION bin)
endif()
endif()
Loading

0 comments on commit 601d2cd

Please sign in to comment.