#include #include #include #include #include #include #include namespace { class StkToolsA : public stk::unit_test_util::MeshFixture { }; TEST_F(StkToolsA, WriteTextMeshDescFromExodusFile) { const std::string unNamed = "mesh not specified"; const std::string meshName = stk::unit_test_util::get_option("-i", unNamed); STK_ThrowRequireMsg(meshName!=unNamed, "Please specify mesh with -i option."); setup_mesh(meshName, stk::mesh::BulkData::NO_AUTO_AURA); std::ostringstream os; os.precision(16); const stk::mesh::BucketVector &buckets = get_bulk().get_buckets(stk::topology::ELEM_RANK, get_meta().locally_owned_part()); os << "const std::string meshDesc = \""; std::map localToGlobalId; std::vector partOrdinals; unsigned counter = 0; for(size_t i=0;i* coordField = get_meta().get_field(stk::topology::NODE_RANK, "coordinates"); ASSERT_TRUE(coordField!=nullptr); stk::mesh::Selector nodeSelector = get_meta().locally_owned_part() | get_meta().globally_shared_part(); stk::mesh::EntityVector nodes; stk::mesh::get_entities(get_bulk(), stk::topology::NODE_RANK, nodes); os << "std::vector coordinates{\n"; for(stk::mesh::Entity node : nodes) { double *coord = stk::mesh::field_data(*coordField, node); os << coord[0] << ", " << coord[1] << ", " << coord[2] << "," << std::endl; } os << "};\n"; std::ofstream outfile("test.out.txt"); outfile << os.str(); } }