Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Present Material Ids in the Blueprint Plugin #19307

Merged
merged 8 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 28 additions & 8 deletions src/databases/Blueprint/avtBlueprintFileFormat.C
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,9 @@ avtBlueprintFileFormat::AddBlueprintMeshAndFieldMetadata(avtDatabaseMetaData *md
//
// Justin Privitera, Thu Oct 26 12:26:32 PDT 2023
// Fixed warnings.
//
// Justin Privitera, Wed Feb 14 11:37:06 PST 2024
// Present material ids alongside material names.
//
// ****************************************************************************
void
Expand Down Expand Up @@ -1327,6 +1330,13 @@ avtBlueprintFileFormat::AddBlueprintMaterialsMetadata(avtDatabaseMetaData *md,
<< mesh_matset_name
<< " : " << m_matset_info[mesh_matset_name].to_yaml())

// we want to add the matnos to the names
for (size_t i = 0; i < matnames.size(); i ++)
{
int matno = m_matset_info[mesh_matset_name]["matnames"][matnames[i]].to_int64();
matnames[i] = std::to_string(matno) + " " + matnames[i];
}

avtMaterialMetaData *mmd = new avtMaterialMetaData(mesh_matset_name,
mesh_topo_name,
static_cast<int>(matnames.size()),
Expand Down Expand Up @@ -2577,6 +2587,9 @@ avtBlueprintFileFormat::GetAuxiliaryData(const char *var,
// Justin Privitera, Mon Feb 5 14:14:19 PST 2024
// Removed unnecessary material numbers logic now that we have a new
// Conduit.
//
// Justin Privitera, Wed Feb 14 11:37:06 PST 2024
// Present material ids alongside material names.
//
// ****************************************************************************
avtMaterial *
Expand All @@ -2594,21 +2607,14 @@ avtBlueprintFileFormat::GetMaterial(int domain,
mat_name,
n_matset);

std::vector<std::string> matnames = n_matset["matnames"].child_names();
// package up char ptrs
std::vector<const char *> matnames_ptrs;
for (const auto &matname : matnames)
matnames_ptrs.push_back(matname.c_str());
auto names = const_cast<char **>(matnames_ptrs.data());

// use to_silo util to convert from bp to the mixslot rep
// that silo and visit use

Node n_silo_matset;
conduit::blueprint::mesh::matset::to_silo(n_matset,
n_silo_matset);

int nmats = static_cast<int>(matnames.size());
int nmats = static_cast<int>(n_silo_matset["material_map"].number_of_children());
int nzones = static_cast<int>(n_silo_matset["matlist"].dtype().number_of_elements());
int *matlist = NULL;
int *mix_mat = NULL;
Expand All @@ -2623,6 +2629,20 @@ avtBlueprintFileFormat::GetMaterial(int domain,
matnos.push_back(n_mat.to_int());
}

std::vector<std::string> matnames;
for (const auto &matname : n_silo_matset["material_map"].child_names())
{
const int matno = n_silo_matset["material_map"][matname].to_int64();
const std::string mat_num_and_name = std::to_string(matno) + " " + matname;
matnames.push_back(mat_num_and_name);
}

// package up char ptrs
std::vector<const char *> matnames_ptrs;
for (const auto &matname : matnames)
matnames_ptrs.push_back(matname.c_str());
auto names = const_cast<char **>(matnames_ptrs.data());

// we need int ptrs for the avtMaterial object,
// convert if needed

Expand Down
1 change: 1 addition & 0 deletions src/resources/help/en_US/relnotes3.4.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<li>VisIt's CLI has a new <i>GetLastMessage()</i> function that returns the last message that VisIt issued, regardless of its type.</li>
<li>GetPlotInformation() can now contain entries for multiple-curves when Query-over-time is performed on multiple variables. For example, if a pick-through-time was performed for variables 'u' and 'v', the curve for 'v' would be retrieved via 'GetPlotInformation()['Curves']['v']. Single variable results will still be retrieved via 'GetPlotInformation()['Curve'].
<li>A number of improvements were made to the UNV plugin including quadric elements, support for antique SDRC/I-Deas files prior to Master Series (versions 4,5 and 6), GMSH hidden polygon linear element.</li>
<li>The Blueprint Reader now presents material ids alongside material names when plotting materials.</li>
</ul>

<p>Click the following link to view the release notes for the previous version
Expand Down