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

Extend rtt_viz::Ensight_Translator's ensight_dump function. #478

Merged
merged 1 commit into from
Sep 20, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ds++/UnitTest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public:
}
/*!
* \brief Returns the path of the test source directory (useful for locating
* input files).
* input files).
*
* This function depends on the cmake build system setting the
* COMPILE_DEFINITIONS target property. This should be done in
Expand Down
5 changes: 1 addition & 4 deletions src/units/MathConstants.hh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
* light, etc) are defined.
* \date Fri Nov 07 10:04:52 2003
* \note Copyright (C) 2016-2018 Los Alamos National Security, LLC.
* All rights reserved.
*/
//---------------------------------------------------------------------------//
// $Id: MathConstants.hh 7431 2015-02-24 17:10:44Z kellyt $
* All rights reserved. */
//---------------------------------------------------------------------------//

#ifndef __units_MathConstants_hh__
Expand Down
8 changes: 4 additions & 4 deletions src/viz/Ensight_Translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ void Ensight_Translator::create_filenames(const std_string &prefix) {
/*!
* \brief Common initializer for constructors.
*
* \param graphics_continue If true, use existing ensight directory.
* If false, create or wipe out the existing directory.
* \param[in] graphics_continue If true, use existing ensight directory. If
* false, create or wipe out the existing directory.
*/
void Ensight_Translator::initialize(const bool graphics_continue) {
using std::strerror;
Expand Down Expand Up @@ -232,8 +232,8 @@ void Ensight_Translator::initialize(const bool graphics_continue) {

// build the ensight directory if this is not a continuation
if (!graphics_continue) {
// We have guaranteed that our prefix directory exists at this
// point. Now, wipe out files that we might have created in there...
// We have guaranteed that our prefix directory exists at this point. Now,
// wipe out files that we might have created in there...
if (!stat_ret) {
rtt_dsxx::draco_remove_dir(d_prefix);
rtt_dsxx::draco_mkdir(d_prefix);
Expand Down
18 changes: 9 additions & 9 deletions src/viz/Ensight_Translator.i.hh
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,10 @@ void Ensight_Translator::ensight_dump(
Require(rgn_numbers.size() == nrgn);

// create the parts list
vector<int>::const_iterator find_location_c;
vector<int>::iterator find_location;
vector<int> parts_list;
ISF parts_list;

for (size_t i = 0; i < ncells; ++i) {
find_location =
auto const find_location =
find(parts_list.begin(), parts_list.end(), cell_rgn_index[i]);

if (find_location == parts_list.end())
Expand All @@ -208,7 +206,7 @@ void Ensight_Translator::ensight_dump(
vector<string> part_names;

for (size_t i = 0; i < nparts; ++i) {
find_location_c =
auto const find_location_c =
find(rgn_numbers.begin(), rgn_numbers.end(), parts_list[i]);

if (find_location_c != rgn_numbers.end()) {
Expand Down Expand Up @@ -237,13 +235,14 @@ void Ensight_Translator::ensight_dump(
// Initialize cells_of_type and vertices_of_part.

for (size_t i = 0; i < ncells; ++i) {
find_location =
auto const find_location =
find(parts_list.begin(), parts_list.end(), cell_rgn_index[i]);

Check(find_location != parts_list.end());
Check(iel_type[i] < static_cast<int>(d_num_cell_types));
Check(iel_type[i] >= 0);
Check(static_cast<unsigned>(iel_type[i]) < d_num_cell_types);

auto ipart = find_location - parts_list.begin();
auto const ipart = find_location - parts_list.begin();

Check(i < INT_MAX);
cells_of_type[ipart][iel_type[i]].push_back(static_cast<int>(i));
Expand Down Expand Up @@ -365,7 +364,8 @@ void Ensight_Translator::write_part(
sf2_int cells_of_type(d_num_cell_types);

for (size_t i = 0; i < ncells; ++i) {
Check(iel_type[i] < static_cast<int>(d_num_cell_types));
Check(iel_type[i] >= 0);
Check(static_cast<unsigned>(iel_type[i]) < d_num_cell_types);
Check(i < INT_MAX);
cells_of_type[iel_type[i]].push_back(static_cast<int>(i));
}
Expand Down
18 changes: 10 additions & 8 deletions src/viz/test/tstEnsight_Translator.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//----------------------------------*-C++-*----------------------------------//
/*!
* \file viz/test/tstEnsightTranslator.cc
* \file viz/test/tstEnsight_Translator.cc
* \author Thomas M. Evans
* \date Mon Jan 24 11:12:59 2000
* \brief Ensight_Translator test.
Expand All @@ -18,6 +18,7 @@ using namespace std;
using rtt_viz::Ensight_Translator;

//---------------------------------------------------------------------------//
template <typename IT>
void ensight_dump_test(rtt_dsxx::UnitTest &ut, bool const binary) {
if (binary)
cout << "\nGenerating binary files...\n" << endl;
Expand All @@ -33,7 +34,7 @@ void ensight_dump_test(rtt_dsxx::UnitTest &ut, bool const binary) {
size_t nrgn = 2;

typedef vector<string> vec_s;
typedef vector<int> vec_i;
typedef vector<IT> vec_i;
typedef vector<vec_i> vec2_i;
typedef vector<vec2_i> vec3_i;
typedef vector<double> vec_d;
Expand Down Expand Up @@ -157,10 +158,7 @@ void ensight_dump_test(rtt_dsxx::UnitTest &ut, bool const binary) {

for (size_t k = 0; k < ipar[g].size(); k++) {
int tmp = ipar[g][k] - 1;

vector<int>::iterator f =
find(g_vrtx_indices[i].begin(), g_vrtx_indices[i].end(), tmp);

auto f = find(g_vrtx_indices[i].begin(), g_vrtx_indices[i].end(), tmp);
Require(f != g_vrtx_indices[i].end());
p_ipar[i][j][k] = static_cast<int>(f - g_vrtx_indices[i].begin() + 1);
}
Expand Down Expand Up @@ -235,11 +233,15 @@ int main(int argc, char *argv[]) {
try {
// ASCII dumps
bool binary(false);
ensight_dump_test(ut, binary);
ensight_dump_test<int>(ut, binary);

// Binary dumps
binary = true;
ensight_dump_test(ut, binary);
ensight_dump_test<int>(ut, binary);

// ASCII dumps with unsigned integer data
binary = false;
ensight_dump_test<uint32_t>(ut, binary);
}
UT_EPILOG(ut);
}
Expand Down