Files

101 lines
3.1 KiB
C++

#ifndef FESA_ELEMENTS_DS4_THERMAL_H_
#define FESA_ELEMENTS_DS4_THERMAL_H_
#include <array>
#include <limits>
#include <utility>
#include <vector>
#include "fesa/elements/element_definition.h"
namespace fesa {
/// @brief Defines one four-node uncoupled transient thermal DS4 element.
/// @note This semantic definition contains no geometry kernel or equation
/// state.
class Ds4ThermalDefinition final : public ElementDefinition {
public:
/// @brief Marks that DS4 has no entry in Domain::Properties().
static constexpr EntityIndex kNoPropertyIndex =
(std::numeric_limits<EntityIndex>::max)();
Ds4ThermalDefinition(SourceEntityId source_id,
std::array<EntityIndex, 4> node_indices,
EntityIndex section_index, SourceLocation location);
ElementDefinitionKind Kind() const noexcept override;
const SourceEntityId& SourceId() const noexcept override;
std::string_view SourceElementType() const noexcept override;
const std::vector<EntityIndex>& NodeIndices() const noexcept override;
EntityIndex MaterialIndex() const noexcept override;
EntityIndex PropertyIndex() const noexcept override;
/// @brief Returns the stable thermal-section collection position.
EntityIndex ThermalSectionIndex() const noexcept;
/// @brief Returns the source location defining this element.
const SourceLocation& Location() const noexcept;
private:
friend class Domain;
void BindMaterialIndex(EntityIndex material_index) noexcept;
SourceEntityId source_id_;
std::array<EntityIndex, 4> node_indices_;
std::vector<EntityIndex> node_indices_view_;
EntityIndex section_index_;
EntityIndex material_index_{0U};
SourceLocation location_;
};
inline Ds4ThermalDefinition::Ds4ThermalDefinition(
SourceEntityId source_id, std::array<EntityIndex, 4> node_indices,
EntityIndex section_index, SourceLocation location)
: source_id_{std::move(source_id)},
node_indices_{node_indices},
node_indices_view_{node_indices.begin(), node_indices.end()},
section_index_{section_index},
location_{std::move(location)} {}
inline ElementDefinitionKind Ds4ThermalDefinition::Kind() const noexcept {
return ElementDefinitionKind::kDs4Thermal;
}
inline const SourceEntityId& Ds4ThermalDefinition::SourceId() const noexcept {
return source_id_;
}
inline std::string_view Ds4ThermalDefinition::SourceElementType()
const noexcept {
return "DS4";
}
inline const std::vector<EntityIndex>& Ds4ThermalDefinition::NodeIndices()
const noexcept {
return node_indices_view_;
}
inline EntityIndex Ds4ThermalDefinition::MaterialIndex() const noexcept {
return material_index_;
}
inline EntityIndex Ds4ThermalDefinition::PropertyIndex() const noexcept {
return kNoPropertyIndex;
}
inline EntityIndex Ds4ThermalDefinition::ThermalSectionIndex() const noexcept {
return section_index_;
}
inline const SourceLocation& Ds4ThermalDefinition::Location() const noexcept {
return location_;
}
inline void Ds4ThermalDefinition::BindMaterialIndex(
EntityIndex material_index) noexcept {
material_index_ = material_index;
}
} // namespace fesa
#endif // FESA_ELEMENTS_DS4_THERMAL_H_