Commit b2788469 authored by Kitware Robot's avatar Kitware Robot Committed by Ben Boeckel

ioss 2020-05-19 (1b6f42f4)

Code extracted from:

    https://gitlab.kitware.com/third-party/seacas.git

at commit 1b6f42f42ee2d1e3a1d06d8d9aa6f586a39fe401 (ioss/for/vtk-20200519-v2020-04-27).
parents
* -whitespace
set(SEACAS_HAVE_MPI OFF)
# XXX(kitware): MPI support needs to come from hdf5 and netcdf. Then exodus
# needs to detect that and enable its MPI APIs.
# if (TARGET VTK::mpi)
# set(SEACAS_HAVE_MPI ON)
# endif ()
set(SEACAS_HAVE_EXODUS ON)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/SEACASIoss_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/SEACASIoss_config.h")
set(classes
Ioss_Assembly
Ioss_Beam2
Ioss_Beam3
Ioss_Beam4
Ioss_Blob
Ioss_CommSet
Ioss_CompositeVariableType
Ioss_ConcreteVariableType
Ioss_ConstructedVariableType
Ioss_CoordinateFrame
Ioss_DatabaseIO
Ioss_Edge2
Ioss_Edge2D2
Ioss_Edge2D3
Ioss_Edge3
Ioss_Edge4
Ioss_EdgeBlock
Ioss_EdgeSet
Ioss_ElementBlock
Ioss_ElementSet
Ioss_ElementTopology
Ioss_EntityBlock
Ioss_EntitySet
Ioss_FaceBlock
Ioss_FaceGenerator
Ioss_FaceSet
Ioss_Field
Ioss_FieldManager
Ioss_FileInfo
Ioss_GetLongOpt
Ioss_GroupingEntity
Ioss_Hex16
Ioss_Hex20
Ioss_Hex27
Ioss_Hex32
Ioss_Hex64
Ioss_Hex8
Ioss_Initializer
Ioss_IOFactory
Ioss_Map
Ioss_Node
Ioss_NodeBlock
Ioss_NodeSet
Ioss_ParallelUtils
Ioss_Property
Ioss_PropertyManager
Ioss_Pyramid13
Ioss_Pyramid14
Ioss_Pyramid18
Ioss_Pyramid19
Ioss_Pyramid5
Ioss_Quad12
Ioss_Quad16
Ioss_Quad4
Ioss_Quad6
Ioss_Quad8
Ioss_Quad9
Ioss_Region
Ioss_SerializeIO
Ioss_Shell4
Ioss_Shell8
Ioss_Shell9
Ioss_ShellLine2D2
Ioss_ShellLine2D3
Ioss_SideBlock
Ioss_SideSet
Ioss_SmartAssert
Ioss_Sphere
Ioss_Spring2
Ioss_Spring3
Ioss_StructuredBlock
Ioss_Super
Ioss_Tet10
Ioss_Tet11
Ioss_Tet14
Ioss_Tet15
Ioss_Tet16
Ioss_Tet4
Ioss_Tet40
Ioss_Tet7
Ioss_Tet8
Ioss_Tracer
Ioss_Transform
Ioss_Tri13
Ioss_Tri3
Ioss_Tri4
Ioss_Tri4a
Ioss_Tri6
Ioss_Tri7
Ioss_Tri9
Ioss_TriShell3
Ioss_TriShell4
Ioss_TriShell6
Ioss_TriShell7
Ioss_Unknown
Ioss_Utils
Ioss_VariableType
Ioss_Wedge12
Ioss_Wedge15
Ioss_Wedge16
Ioss_Wedge18
Ioss_Wedge20
Ioss_Wedge21
Ioss_Wedge24
Ioss_Wedge52
Ioss_Wedge6
Ioss_ZoneConnectivity
tokenize
exodus/Ioex_BaseDatabaseIO
exodus/Ioex_DatabaseIO
exodus/Ioex_Internals
exodus/Ioex_IOFactory
exodus/Ioex_SuperElement
exodus/Ioex_Utils
gen_struc/Iogs_DatabaseIO
gen_struc/Iogs_GeneratedMesh
generated/Iogn_DashSurfaceMesh
generated/Iogn_DatabaseIO
generated/Iogn_GeneratedMesh
heartbeat/Iohb_DatabaseIO
heartbeat/Iohb_Layout
init/Ionit_Initializer
transform/Iotr_Initializer
transform/Iotr_MinMax
transform/Iotr_Offset
transform/Iotr_Offset3D
transform/Iotr_Scale
transform/Iotr_Scale3D
transform/Iotr_Tensor
transform/Iotr_VectorMagnitude)
if (SEACAS_HAVE_MPI)
list(APPEND classes
Ioss_Decomposition
exodus/Ioex_DecompositionData
exodus/Ioex_ParallelDatabaseIO)
endif ()
set(sources)
set(headers)
foreach (class IN LISTS classes)
list(APPEND sources "${class}.C")
list(APPEND headers "${class}.h")
endforeach ()
set(c_sources
Ioss_Getline)
foreach (c_source IN LISTS c_sources)
list(APPEND sources "${c_source}.c")
list(APPEND headers "${c_source}.h")
endforeach ()
list(APPEND sources
transform/Iotr_Factory.C)
list(APPEND headers
catch.hpp
Ioss_BoundingBox.h
Ioss_CodeTypes.h
Ioss_DataSize.h
Ioss_DBUsage.h
Ioss_Doxygen.h
Ioss_ElementVariableType.h
Ioss_EntityType.h
Ioss_MeshCopyOptions.h
Ioss_MeshType.h
Ioss_NamedSuffixVariableType.h
Ioss_NullEntity.h
Ioss_ScopeGuard.h
Ioss_Sort.h
Ioss_StandardElementTypes.h
Ioss_State.h
Ioss_SubSystem.h
Ioss_SurfaceSplit.h
Ioss_Version.h
fmt/chrono.h
fmt/color.h
fmt/compile.h
fmt/core.h
fmt/format-inl.h
fmt/format.h
fmt/locale.h
fmt/os.h
fmt/ostream.h
fmt/posix.h
fmt/printf.h
fmt/ranges.h
hash/bhopscotch_map.h
hash/bhopscotch_set.h
hash/hopscotch_growth_policy.h
hash/hopscotch_hash.h
hash/hopscotch_map.h
hash/hopscotch_set.h
hash/robin_growth_policy.h
hash/robin_hash.h
hash/robin_map.h
hash/robin_set.h
vtk_ioss_mangle.h)
vtk_module_add_module(VTK::ioss
SOURCES ${sources}
PRIVATE_HEADERS ${headers})
vtk_module_definitions(VTK::ioss
PRIVATE
NO_ZOLTAN_SUPPORT
NO_PARMETIS_SUPPORT)
Copyright(C) 1999-2017 National Technology & Engineering Solutions
of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
NTESS, the U.S. Government retains certain rights in this software.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of NTESS nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Copyright(C) 2019, 2020 National Technology & Engineering Solutions
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
// NTESS, the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// * Neither the name of NTESS nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <Ioss_Assembly.h>
#include <Ioss_DatabaseIO.h>
#include <Ioss_GroupingEntity.h>
#include <Ioss_Property.h>
#include <Ioss_PropertyManager.h>
#include <Ioss_Region.h>
#include <algorithm>
#include <cstddef>
#include <fmt/ostream.h>
#include <string>
#include <vector>
namespace {
const std::string id_str() { return std::string("id"); }
void check_is_valid(const Ioss::Assembly *assem, const Ioss::GroupingEntity *member)
{
// Ensure that `member` is not already a member and that its type matches
// the current type.
const std::string &name = member->name();
// Don't add an assembly to itself...
if (assem == member) {
std::ostringstream errmsg;
fmt::print(errmsg,
"\nERROR: Attempting to add assembly '{}' to itself. This is not allowed.", name);
IOSS_ERROR(errmsg);
}
// See if there is a member with this name...
const Ioss::GroupingEntity *old_ge = assem->get_member(name);
if (old_ge != nullptr) {
std::string filename = assem->get_database()->get_filename();
int64_t id1 = 0;
int64_t id2 = 0;
if (member->property_exists(id_str())) {
id1 = member->get_property(id_str()).get_int();
}
if (old_ge->property_exists(id_str())) {
id2 = old_ge->get_property(id_str()).get_int();
}
std::ostringstream errmsg;
fmt::print(errmsg,
"\nERROR: There are multiple assembly members named '{}' "
"defined in assembly '{}' in the database file '{}'.\n"
"\tBoth {} {} and {} {} are named '{}'. All names must be unique.",
name, assem->name(), filename, member->type_string(), id1, old_ge->type_string(),
id2, name);
IOSS_ERROR(errmsg);
}
if (assem->member_count() > 0) {
if (member->type() != assem->get_member_type()) {
std::ostringstream errmsg;
std::string filename = assem->get_database()->get_filename();
fmt::print(errmsg,
"\nERROR: The entity type of '{}' ({}) does not match the entity type of "
"assembly '{}' ({}).\n\tAn assembly's member entities must be "
"homogeneous. In the database file '{}'.\n",
member->name(), member->type_string(), assem->name(), assem->contains_string(),
filename);
IOSS_ERROR(errmsg);
}
}
}
} // namespace
namespace Ioss {
class Field;
} // namespace Ioss
/** \brief Create an assembly with no members initially.
*
* \param[in] io_database The database associated with the region containing the assembly.
* \param[in] my_name The assembly's name.
*/
Ioss::Assembly::Assembly(Ioss::DatabaseIO *io_database, const std::string &my_name)
: Ioss::GroupingEntity(io_database, my_name, 1)
{
properties.add(Ioss::Property(this, "member_count", Ioss::Property::INTEGER));
properties.add(Ioss::Property(this, "member_type", Ioss::Property::INTEGER));
}
Ioss::Assembly::Assembly(const Ioss::Assembly &other) : GroupingEntity(other)
{
m_members = other.m_members;
m_type = other.m_type;
}
const Ioss::EntityContainer &Ioss::Assembly::get_members() const { return m_members; }
const Ioss::GroupingEntity *Ioss::Assembly::get_member(const std::string &my_name) const
{
IOSS_FUNC_ENTER(m_);
const Ioss::GroupingEntity *ge = nullptr;
for (auto mem : m_members) {
if (mem->name() == my_name) {
ge = mem;
break;
}
}
return ge;
}
bool Ioss::Assembly::add(const Ioss::GroupingEntity *member)
{
check_is_valid(this, member);
IOSS_FUNC_ENTER(m_);
m_members.push_back(member);
if (m_members.size() == 1) {
m_type = member->type();
}
return true;
}
bool Ioss::Assembly::remove(const Ioss::GroupingEntity *removal)
{
IOSS_FUNC_ENTER(m_);
for (size_t i = 0; i < m_members.size(); i++) {
if (m_members[i] == removal) {
m_members.erase(m_members.begin() + i);
return true;
}
}
return false;
}
int64_t Ioss::Assembly::internal_get_field_data(const Ioss::Field &field, void *data,
size_t data_size) const
{
return get_database()->get_field(this, field, data, data_size);
}
int64_t Ioss::Assembly::internal_put_field_data(const Ioss::Field &field, void *data,
size_t data_size) const
{
return get_database()->put_field(this, field, data, data_size);
}
Ioss::Property Ioss::Assembly::get_implicit_property(const std::string &my_name) const
{
if (my_name == "member_count") {
return Ioss::Property(my_name, static_cast<int>(m_members.size()));
}
if (my_name == "member_type") {
return Ioss::Property(my_name, static_cast<int>(m_type));
}
return Ioss::GroupingEntity::get_implicit_property(my_name);
}
// Copyright(C) 2019, 2020 National Technology & Engineering Solutions
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
// NTESS, the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// * Neither the name of NTESS nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef IOSS_Ioss_Assembly_h
#define IOSS_Ioss_Assembly_h
#include "vtk_ioss_mangle.h"
#include "Ioss_EntityType.h" // for EntityType, etc
#include "Ioss_Property.h" // for Property
#include <Ioss_GroupingEntity.h>
#include <cstddef> // for size_t
#include <cstdint> // for int64_t
#include <string> // for string
namespace Ioss {
class DatabaseIO;
class Field;
} // namespace Ioss
namespace Ioss {
using EntityContainer = std::vector<const Ioss::GroupingEntity *>;
/** \brief A homogeneous collection of other GroupingEntities.
*/
class Assembly : public GroupingEntity
{
public:
Assembly() = default; // Used for template typing only
~Assembly() = default;
Assembly(const Assembly &);
Assembly(DatabaseIO *io_database, const std::string &my_name);
std::string type_string() const override { return "Assembly"; }
std::string short_type_string() const override { return "assembly"; }
std::string contains_string() const override
{
return m_members.empty() ? "<EMPTY>" : m_members[0]->type_string();
}
EntityType type() const override { return ASSEMBLY; }
EntityType get_member_type() const { return m_type; }
bool add(const GroupingEntity *member);
bool remove(const GroupingEntity *member);
const EntityContainer &get_members() const;
const GroupingEntity * get_member(const std::string &my_name) const;
size_t member_count() const { return m_members.size(); }
// Handle implicit properties -- These are calcuated from data stored
// in the grouping entity instead of having an explicit value assigned.
// An example would be 'element_block_count' for a region.
Property get_implicit_property(const std::string &my_name) const override;
protected:
int64_t internal_get_field_data(const Field &field, void *data,
size_t data_size) const override;
int64_t internal_put_field_data(const Field &field, void *data,
size_t data_size) const override;
private:
EntityContainer m_members;
EntityType m_type{INVALID_TYPE};
};
} // namespace Ioss
#endif
// Copyright(C) 1999-2017 National Technology & Engineering Solutions
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
// NTESS, the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// * Neither the name of NTESS nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Ioss_CodeTypes.h" // for IntVector
#include "Ioss_ElementTopology.h" // for ElementTopology
#include <Ioss_Beam2.h>
#include <Ioss_ElementVariableType.h> // for ElementVariableType
#include <cassert> // for assert
#include <cstddef> // for nullptr
//------------------------------------------------------------------------
// Define a variable type for storage of this elements connectivity
namespace Ioss {
const char *Beam2::name = "bar2";
class St_Beam2 : public ElementVariableType
{
public:
static void factory() { static St_Beam2 registerThis; }
protected:
St_Beam2() : ElementVariableType(Ioss::Beam2::name, 2) {}
};
} // namespace Ioss
// ========================================================================
namespace {
struct Constants
{
static const int nnode = 2;
static const int nedge = 2;
static const int nedgenode = 2;
static const int nface = 0;
static const int nfacenode = 0;
static const int nfaceedge = 0;
};