feat(solid): add Hex8 input and three-DOF semantics
This commit is contained in:
@@ -98,7 +98,8 @@ Status ValidateShellMoments(const Domain& domain, const Vector& full_load) {
|
||||
} // namespace
|
||||
|
||||
Result<Vector> LoadAssembler::AssembleFullNodalLoad(const AnalysisModel& model,
|
||||
const DofManager& dofs) {
|
||||
const DofManager& dofs,
|
||||
double step_time) {
|
||||
const auto& active_loads = model.ActiveLoads();
|
||||
const auto& owned_loads = model.Step().Loads();
|
||||
if (active_loads.size() != owned_loads.size()) {
|
||||
@@ -122,21 +123,31 @@ Result<Vector> LoadAssembler::AssembleFullNodalLoad(const AnalysisModel& model,
|
||||
}
|
||||
loads.push_back(owned_loads[load_index]);
|
||||
}
|
||||
return AssembleFullNodalLoad(model, dofs, loads);
|
||||
return AssembleFullNodalLoad(model, dofs, loads, step_time);
|
||||
}
|
||||
|
||||
Result<Vector> LoadAssembler::AssembleFullNodalLoad(const AnalysisModel& model,
|
||||
const DofManager& dofs,
|
||||
const LoadView& loads) {
|
||||
const LoadView& loads,
|
||||
double step_time) {
|
||||
const Domain& domain = model.GetDomain();
|
||||
const std::size_t components = dofs.ComponentsPerNode();
|
||||
if (dofs.Profile() == DofProfile::kThermal ||
|
||||
(domain.IsSolid() != (dofs.Profile() == DofProfile::kSolidStructural)) ||
|
||||
!std::isfinite(step_time) || step_time < 0.0) {
|
||||
return Result<Vector>::Failure(LoadFailure(
|
||||
"invalid-load-context", {domain.SourcePath(), 0U}, "LOAD_ASSEMBLER", "",
|
||||
"Nodal loads require the matching structural profile and finite "
|
||||
"nonnegative endpoint time."));
|
||||
}
|
||||
if (domain.Nodes().size() >
|
||||
(std::numeric_limits<std::size_t>::max)() / kDofsPerNode) {
|
||||
(std::numeric_limits<std::size_t>::max)() / components) {
|
||||
return Result<Vector>::Failure(LoadFailure(
|
||||
"invalid-load-dimensions", {domain.SourcePath(), 0U}, "LOAD_ASSEMBLER",
|
||||
domain.SourceContentIdentity(),
|
||||
"The semantic node count cannot be represented in full-DOF order."));
|
||||
}
|
||||
const std::size_t expected_full_count = domain.Nodes().size() * kDofsPerNode;
|
||||
const std::size_t expected_full_count = domain.Nodes().size() * components;
|
||||
if (dofs.FullDofCount() != expected_full_count) {
|
||||
return Result<Vector>::Failure(LoadFailure(
|
||||
"invalid-load-dimensions", {domain.SourcePath(), 0U}, "LOAD_ASSEMBLER",
|
||||
@@ -148,11 +159,11 @@ Result<Vector> LoadAssembler::AssembleFullNodalLoad(const AnalysisModel& model,
|
||||
return Result<Vector>::Failure(dof_status);
|
||||
}
|
||||
for (std::size_t node = 0U; node < domain.Nodes().size(); ++node) {
|
||||
for (std::size_t component = 0U; component < kDofsPerNode; ++component) {
|
||||
for (std::size_t component = 0U; component < components; ++component) {
|
||||
try {
|
||||
if (dofs.FullDof(static_cast<EntityIndex>(node),
|
||||
static_cast<DofComponent>(component)) !=
|
||||
node * kDofsPerNode + component) {
|
||||
node * components + component) {
|
||||
return Result<Vector>::Failure(LoadFailure(
|
||||
"invalid-load-order", domain.Nodes()[node].location,
|
||||
"LOAD_ASSEMBLER",
|
||||
@@ -170,7 +181,7 @@ Result<Vector> LoadAssembler::AssembleFullNodalLoad(const AnalysisModel& model,
|
||||
|
||||
const SourceTargetIndex target_index = SourceTargetIndex::FromDomain(domain);
|
||||
const SourceTargetResolver target_resolver{target_index};
|
||||
const LoadContext context{domain, dofs, target_resolver};
|
||||
const LoadContext context{domain, dofs, target_resolver, step_time};
|
||||
|
||||
std::vector<std::vector<LoadContribution>> contributions_by_load;
|
||||
contributions_by_load.reserve(loads.size());
|
||||
|
||||
@@ -116,8 +116,12 @@ Result<DofManager> DofManager::Create(const AnalysisModel& model) {
|
||||
"An active element index is outside the Domain."));
|
||||
}
|
||||
const auto& definition = domain.Elements()[element_index];
|
||||
layouts.push_back({definition.SourceId(), definition.NodeIndices(),
|
||||
FullNodeComponents()});
|
||||
layouts.push_back(
|
||||
{definition.SourceId(), definition.NodeIndices(),
|
||||
domain.IsSolid()
|
||||
? std::vector<DofComponent>{DofComponent::kUx, DofComponent::kUy,
|
||||
DofComponent::kUz}
|
||||
: FullNodeComponents()});
|
||||
}
|
||||
|
||||
DofManager dofs;
|
||||
@@ -305,6 +309,19 @@ Status DofManager::BuildLayouts(const AnalysisModel& analysis_model,
|
||||
++source_order) {
|
||||
const EntityIndex definition_index =
|
||||
analysis_model.ActiveElements()[source_order];
|
||||
if (domain.IsSolid()) {
|
||||
const std::vector<DofComponent> translations{
|
||||
DofComponent::kUx, DofComponent::kUy, DofComponent::kUz};
|
||||
if (layouts[source_order].components_per_node != translations ||
|
||||
definition_index >= domain.Elements().Size() ||
|
||||
layouts[source_order].node_indices !=
|
||||
domain.Elements()[definition_index].NodeIndices()) {
|
||||
return DofFailure(
|
||||
"invalid-solid-element-layout", {domain.SourcePath(), 0U},
|
||||
std::to_string(source_order),
|
||||
"Solid layouts require source-ordered eight nodes and UX/UY/UZ.");
|
||||
}
|
||||
}
|
||||
if (definition_index >= domain.Elements().Size() ||
|
||||
!SameSourceIdentity(layouts[source_order].source_id,
|
||||
domain.Elements()[definition_index].SourceId())) {
|
||||
@@ -318,10 +335,13 @@ Status DofManager::BuildLayouts(const AnalysisModel& analysis_model,
|
||||
|
||||
const SourceTargetIndex target_index = SourceTargetIndex::FromDomain(domain);
|
||||
const SourceTargetResolver target_resolver{target_index};
|
||||
const std::size_t full_count = domain.Nodes().size() * kDofsPerNode;
|
||||
const std::size_t component_count = domain.IsSolid() ? 3U : kDofsPerNode;
|
||||
const std::size_t full_count = domain.Nodes().size() * component_count;
|
||||
|
||||
DofManager full_dof_map;
|
||||
full_dof_map.full_dof_count_ = full_count;
|
||||
full_dof_map.profile_ =
|
||||
domain.IsSolid() ? DofProfile::kSolidStructural : DofProfile::kStructural;
|
||||
const BoundaryConditionContext context{domain, full_dof_map, target_resolver};
|
||||
std::vector<std::vector<ConstraintDefinition>> definitions_by_boundary;
|
||||
definitions_by_boundary.reserve(boundaries.size());
|
||||
@@ -417,6 +437,7 @@ Status DofManager::BuildLayouts(const AnalysisModel& analysis_model,
|
||||
std::move(constrained_dofs),
|
||||
std::move(prescribed_values),
|
||||
{}};
|
||||
candidate.profile_ = full_dof_map.profile_;
|
||||
candidate.element_scatters_.reserve(layouts.size());
|
||||
for (const auto& layout : layouts) {
|
||||
auto scatter = candidate.ElementScatter(layout);
|
||||
@@ -441,6 +462,10 @@ std::size_t DofManager::FullDofCount() const noexcept {
|
||||
}
|
||||
|
||||
DofProfile DofManager::Profile() const noexcept { return profile_; }
|
||||
std::size_t DofManager::ComponentsPerNode() const noexcept {
|
||||
if (profile_ == DofProfile::kThermal) return kThermalDofsPerNode;
|
||||
return profile_ == DofProfile::kSolidStructural ? 3U : kDofsPerNode;
|
||||
}
|
||||
|
||||
std::size_t DofManager::FreeDofCount() const noexcept {
|
||||
return free_dofs_.size();
|
||||
@@ -452,15 +477,16 @@ std::size_t DofManager::ConstrainedDofCount() const noexcept {
|
||||
|
||||
std::size_t DofManager::FullDof(const EntityIndex node,
|
||||
const DofComponent component) const {
|
||||
if (profile_ != DofProfile::kStructural) {
|
||||
throw std::logic_error{"Structural components are invalid for thermal DOFs."};
|
||||
if (profile_ == DofProfile::kThermal) {
|
||||
throw std::logic_error{
|
||||
"Structural components are invalid for thermal DOFs."};
|
||||
}
|
||||
const std::size_t component_index = static_cast<std::size_t>(component);
|
||||
if (node >= full_dof_count_ / kDofsPerNode ||
|
||||
component_index >= kDofsPerNode) {
|
||||
if (node >= full_dof_count_ / ComponentsPerNode() ||
|
||||
component_index >= ComponentsPerNode()) {
|
||||
throw std::out_of_range{"Node or DOF component is out of range."};
|
||||
}
|
||||
return static_cast<std::size_t>(node) * kDofsPerNode + component_index;
|
||||
return static_cast<std::size_t>(node) * ComponentsPerNode() + component_index;
|
||||
}
|
||||
|
||||
std::size_t DofManager::FullThermalDof(
|
||||
@@ -481,7 +507,7 @@ std::optional<std::size_t> DofManager::FreeEquation(
|
||||
|
||||
Result<std::vector<std::size_t>> DofManager::ElementScatter(
|
||||
const ElementDofLayout& layout) const {
|
||||
if (profile_ != DofProfile::kStructural) {
|
||||
if (profile_ == DofProfile::kThermal) {
|
||||
return Result<std::vector<std::size_t>>::Failure(DofFailure(
|
||||
"invalid-dof-profile", {}, layout.source_id.source_label_text,
|
||||
"Structural layouts are invalid for a thermal mapping."));
|
||||
@@ -501,8 +527,8 @@ Result<std::vector<std::size_t>> DofManager::ElementScatter(
|
||||
for (const EntityIndex node : layout.node_indices) {
|
||||
for (const DofComponent component : layout.components_per_node) {
|
||||
const std::size_t component_index = static_cast<std::size_t>(component);
|
||||
if (node >= full_dof_count_ / kDofsPerNode ||
|
||||
component_index >= kDofsPerNode) {
|
||||
if (node >= full_dof_count_ / ComponentsPerNode() ||
|
||||
component_index >= ComponentsPerNode()) {
|
||||
return Result<std::vector<std::size_t>>::Failure(DofFailure(
|
||||
"invalid-element-dof-layout", {},
|
||||
layout.source_id.source_label_text,
|
||||
@@ -510,7 +536,8 @@ Result<std::vector<std::size_t>> DofManager::ElementScatter(
|
||||
"DOF range."));
|
||||
}
|
||||
const std::size_t full_dof =
|
||||
static_cast<std::size_t>(node) * kDofsPerNode + component_index;
|
||||
static_cast<std::size_t>(node) * ComponentsPerNode() +
|
||||
component_index;
|
||||
if (std::find(scatter.begin(), scatter.end(), full_dof) !=
|
||||
scatter.end()) {
|
||||
return Result<std::vector<std::size_t>>::Failure(DofFailure(
|
||||
|
||||
@@ -50,7 +50,7 @@ struct RawNode {
|
||||
};
|
||||
|
||||
struct RawElement {
|
||||
enum class Type { kB33, kS4, kS4r, kDs4 };
|
||||
enum class Type { kB33, kS4, kS4r, kDs4, kC3d8 };
|
||||
|
||||
std::int64_t label;
|
||||
std::string label_text;
|
||||
@@ -59,7 +59,7 @@ struct RawElement {
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
enum class ElementFamily { kBeam, kShell, kThermalShell };
|
||||
enum class ElementFamily { kBeam, kShell, kThermalShell, kSolid };
|
||||
|
||||
struct RawSet {
|
||||
std::string name;
|
||||
@@ -83,6 +83,12 @@ struct RawShellSection {
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
struct RawSolidSection {
|
||||
std::string element_set_name;
|
||||
std::string material_name;
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
struct RawPart {
|
||||
std::string name;
|
||||
SourceLocation location;
|
||||
@@ -92,6 +98,7 @@ struct RawPart {
|
||||
std::vector<RawSet> element_sets;
|
||||
std::vector<RawSection> sections;
|
||||
std::vector<RawShellSection> shell_sections;
|
||||
std::vector<RawSolidSection> solid_sections;
|
||||
};
|
||||
|
||||
struct RawInstance {
|
||||
@@ -170,6 +177,8 @@ struct RawStep {
|
||||
std::string name_raw;
|
||||
std::string name_canonical;
|
||||
bool has_static{false};
|
||||
bool static_direct{false};
|
||||
std::uint32_t static_increment_count{0U};
|
||||
std::optional<DynamicStepDefinition> dynamic;
|
||||
bool perturbation_explicit{false};
|
||||
bool nlgeom_explicit{false};
|
||||
@@ -746,6 +755,10 @@ class DomainMappingContext::Impl {
|
||||
ParseAssemblyStart(block);
|
||||
return;
|
||||
}
|
||||
if (block.canonical_name == "AMPLITUDE") {
|
||||
ParseAmplitude(block);
|
||||
return;
|
||||
}
|
||||
if (block.canonical_name == "MATERIAL") {
|
||||
ParseMaterial(block);
|
||||
return;
|
||||
@@ -841,7 +854,8 @@ class DomainMappingContext::Impl {
|
||||
model_element_family_ == ElementFamily::kShell ||
|
||||
model_element_family_ == ElementFamily::kThermalShell;
|
||||
if (part.nodes.empty() || part.elements.empty() ||
|
||||
(!shell_part && part.sections.empty())) {
|
||||
(!shell_part && model_element_family_ != ElementFamily::kSolid &&
|
||||
part.sections.empty())) {
|
||||
InvalidKeywordLocation(block,
|
||||
"A part closes only after node, element, "
|
||||
"and matching section blocks.");
|
||||
@@ -917,7 +931,8 @@ class DomainMappingContext::Impl {
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kShell ||
|
||||
model_element_family_ == ElementFamily::kThermalShell) {
|
||||
model_element_family_ == ElementFamily::kThermalShell ||
|
||||
model_element_family_ == ElementFamily::kSolid) {
|
||||
InputFailure(
|
||||
"unsupported-mixed-element-model", block.location,
|
||||
block.canonical_name, "",
|
||||
@@ -934,7 +949,8 @@ class DomainMappingContext::Impl {
|
||||
block, "SHELL SECTION follows the part mesh and optional sets.");
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kBeam) {
|
||||
if (model_element_family_ == ElementFamily::kBeam ||
|
||||
model_element_family_ == ElementFamily::kSolid) {
|
||||
InputFailure(
|
||||
"unsupported-mixed-element-model", block.location,
|
||||
block.canonical_name, "",
|
||||
@@ -943,6 +959,17 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
ParseShellSection(block, part);
|
||||
part_sections_seen_ = !failure_;
|
||||
} else if (block.canonical_name == "SOLID SECTION") {
|
||||
beam_section_context_active_ = false;
|
||||
if (!part_elements_seen_ ||
|
||||
model_element_family_ != ElementFamily::kSolid) {
|
||||
InputFailure("invalid-solid-section", block.location,
|
||||
block.canonical_name, "",
|
||||
"SOLID SECTION requires an exclusive C3D8 mesh.");
|
||||
return;
|
||||
}
|
||||
ParseSolidSection(block, part);
|
||||
part_sections_seen_ = !failure_;
|
||||
} else if (block.canonical_name == "SECTION POINTS") {
|
||||
ParseSectionPoints(block, part);
|
||||
} else if (block.canonical_name == "TRANSVERSE SHEAR STIFFNESS") {
|
||||
@@ -1011,10 +1038,12 @@ class DomainMappingContext::Impl {
|
||||
const bool thermal_block =
|
||||
type_parameter && type_parameter->value &&
|
||||
AsciiCaseInsensitiveEquals(*type_parameter->value, "DS4");
|
||||
if (!ValidateParameters(block,
|
||||
thermal_block
|
||||
? std::vector<std::string_view>{"TYPE", "ELSET"}
|
||||
: std::vector<std::string_view>{"TYPE"})) {
|
||||
if (!ValidateParameters(
|
||||
block, (thermal_block || (type_parameter && type_parameter->value &&
|
||||
AsciiCaseInsensitiveEquals(
|
||||
*type_parameter->value, "C3D8")))
|
||||
? std::vector<std::string_view>{"TYPE", "ELSET"}
|
||||
: std::vector<std::string_view>{"TYPE"})) {
|
||||
return;
|
||||
}
|
||||
const auto* type = RequiredParameterValue(block, "TYPE");
|
||||
@@ -1036,6 +1065,10 @@ class DomainMappingContext::Impl {
|
||||
element_type = RawElement::Type::kS4r;
|
||||
element_family = ElementFamily::kShell;
|
||||
expected_field_count = 5U;
|
||||
} else if (AsciiCaseInsensitiveEquals(*type, "C3D8")) {
|
||||
element_type = RawElement::Type::kC3d8;
|
||||
element_family = ElementFamily::kSolid;
|
||||
expected_field_count = 9U;
|
||||
} else if (AsciiCaseInsensitiveEquals(*type, "DS4")) {
|
||||
element_type = RawElement::Type::kDs4;
|
||||
element_family = ElementFamily::kThermalShell;
|
||||
@@ -1043,15 +1076,16 @@ class DomainMappingContext::Impl {
|
||||
} else {
|
||||
InputFailure("unsupported-element-formulation", block.location,
|
||||
block.canonical_name, *type,
|
||||
"Only TYPE=B33, TYPE=S4, TYPE=S4R, and TYPE=DS4 belong to "
|
||||
"Only B33, S4, S4R, DS4, and C3D8 belong to "
|
||||
"the approved "
|
||||
"element subsets.");
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ && *model_element_family_ != element_family) {
|
||||
InputFailure("unsupported-mixed-element-model", block.location,
|
||||
block.canonical_name, *type,
|
||||
"Beam and shell elements cannot be mixed in one model.");
|
||||
InputFailure(
|
||||
"unsupported-mixed-element-model", block.location,
|
||||
block.canonical_name, *type,
|
||||
"Beam, Shell, thermal, and Solid families cannot mix in one model.");
|
||||
return;
|
||||
}
|
||||
model_element_family_ = element_family;
|
||||
@@ -1067,9 +1101,11 @@ class DomainMappingContext::Impl {
|
||||
inline_set = RawSet{*name, {}, block.location};
|
||||
}
|
||||
if (block.data.empty()) {
|
||||
InputFailure(element_family == ElementFamily::kShell
|
||||
? "invalid-shell-connectivity"
|
||||
: "invalid-data-arity",
|
||||
InputFailure(element_family == ElementFamily::kSolid
|
||||
? "invalid-solid-connectivity"
|
||||
: (element_family == ElementFamily::kShell
|
||||
? "invalid-shell-connectivity"
|
||||
: "invalid-data-arity"),
|
||||
block.location, block.canonical_name, "",
|
||||
"ELEMENT requires at least one row with the approved "
|
||||
"connectivity arity.");
|
||||
@@ -1078,9 +1114,11 @@ class DomainMappingContext::Impl {
|
||||
for (const auto& row : block.data) {
|
||||
if (row.fields.size() != expected_field_count) {
|
||||
InputFailure(
|
||||
element_family == ElementFamily::kShell
|
||||
? "invalid-shell-connectivity"
|
||||
: "invalid-data-arity",
|
||||
element_family == ElementFamily::kSolid
|
||||
? "invalid-solid-connectivity"
|
||||
: (element_family == ElementFamily::kShell
|
||||
? "invalid-shell-connectivity"
|
||||
: "invalid-data-arity"),
|
||||
row.location, block.canonical_name, "",
|
||||
element_family == ElementFamily::kShell
|
||||
? "S4 and S4R rows require a label and exactly four nodes."
|
||||
@@ -1108,10 +1146,12 @@ class DomainMappingContext::Impl {
|
||||
const std::set<std::int64_t> distinct_nodes{element.node_labels.begin(),
|
||||
element.node_labels.end()};
|
||||
if (distinct_nodes.size() != element.node_labels.size()) {
|
||||
InputFailure(
|
||||
"invalid-shell-connectivity", row.location, block.canonical_name,
|
||||
element.label_text,
|
||||
"Shell connectivity requires four distinct source nodes.");
|
||||
InputFailure(element_family == ElementFamily::kSolid
|
||||
? "invalid-solid-connectivity"
|
||||
: "invalid-shell-connectivity",
|
||||
row.location, block.canonical_name, element.label_text,
|
||||
"Connectivity requires the specified number of distinct "
|
||||
"source nodes.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1132,6 +1172,101 @@ class DomainMappingContext::Impl {
|
||||
if (inline_set) part.element_sets.push_back(std::move(*inline_set));
|
||||
}
|
||||
|
||||
/// @brief Parses material-only Solid assignment without thickness defaults.
|
||||
void ParseSolidSection(const KeywordBlock& block, RawPart& part) {
|
||||
if (!ValidateParameters(block, {"ELSET", "MATERIAL"})) return;
|
||||
const auto* elset = RequiredParameterValue(block, "ELSET");
|
||||
const auto* material = RequiredParameterValue(block, "MATERIAL");
|
||||
if (!elset || !material) return;
|
||||
if (block.data.size() > 1U ||
|
||||
(!block.data.empty() &&
|
||||
std::any_of(block.data[0].fields.begin(), block.data[0].fields.end(),
|
||||
[](const auto& field) { return !field.empty(); }))) {
|
||||
InputFailure("invalid-solid-section", block.location,
|
||||
block.canonical_name, *elset,
|
||||
"SOLID SECTION permits omitted or blank data only.");
|
||||
return;
|
||||
}
|
||||
part.solid_sections.push_back({*elset, *material, block.location});
|
||||
}
|
||||
|
||||
/// @brief Validates and owns one model-level supported load amplitude.
|
||||
void ParseAmplitude(const KeywordBlock& block) {
|
||||
const bool dynamic_source = std::any_of(
|
||||
input_.blocks.begin(), input_.blocks.end(), [](const auto& candidate) {
|
||||
return candidate.canonical_name == "DYNAMIC";
|
||||
});
|
||||
if (model_element_family_ != ElementFamily::kSolid || !dynamic_source) {
|
||||
InputFailure("unsupported-load-amplitude", block.location,
|
||||
block.canonical_name, "",
|
||||
"Amplitude is supported only in Solid dynamic models.");
|
||||
return;
|
||||
}
|
||||
if (!ValidateParameters(block, {"NAME", "DEFINITION", "TIME", "VALUE"}))
|
||||
return;
|
||||
const auto* name = RequiredParameterValue(block, "NAME");
|
||||
if (!name) return;
|
||||
for (const auto& option :
|
||||
std::array<std::pair<const char*, const char*>, 3>{
|
||||
{{"DEFINITION", "TABULAR"},
|
||||
{"TIME", "STEP TIME"},
|
||||
{"VALUE", "RELATIVE"}}}) {
|
||||
const auto* parameter = Parameter(block, option.first);
|
||||
if (parameter &&
|
||||
(!parameter->value ||
|
||||
!AsciiCaseInsensitiveEquals(*parameter->value, option.second))) {
|
||||
InputFailure("unsupported-amplitude-option", block.location,
|
||||
block.canonical_name, option.first,
|
||||
"Only TABULAR STEP TIME RELATIVE amplitude is supported.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
const std::string canonical = CanonicalizeAscii(*name);
|
||||
if (std::any_of(definition_.amplitudes.begin(),
|
||||
definition_.amplitudes.end(), [&canonical](const auto& a) {
|
||||
return a.name_canonical == canonical;
|
||||
})) {
|
||||
InputFailure("duplicate-amplitude", block.location, block.canonical_name,
|
||||
*name,
|
||||
"Amplitude names must be unique ignoring ASCII case.");
|
||||
return;
|
||||
}
|
||||
TabularAmplitudeDefinition amplitude{*name, canonical, block.location, {}};
|
||||
for (const auto& row : block.data) {
|
||||
if (row.fields.empty() || row.fields.size() % 2U != 0U) {
|
||||
InputFailure("invalid-amplitude-data", row.location,
|
||||
block.canonical_name, *name,
|
||||
"Amplitude rows require complete time/value pairs.");
|
||||
return;
|
||||
}
|
||||
for (std::size_t field = 0U; field < row.fields.size(); field += 2U) {
|
||||
double time = 0.0;
|
||||
double value = 0.0;
|
||||
if (!ParseDouble(row.fields[field], time, row.location,
|
||||
block.canonical_name) ||
|
||||
!ParseDouble(row.fields[field + 1U], value, row.location,
|
||||
block.canonical_name))
|
||||
return;
|
||||
if (time < 0.0 || (!amplitude.points.empty() &&
|
||||
!(time > amplitude.points.back()[0]))) {
|
||||
InputFailure(
|
||||
"invalid-amplitude-data", row.location, block.canonical_name,
|
||||
*name,
|
||||
"Amplitude times must be nonnegative and strictly increasing.");
|
||||
return;
|
||||
}
|
||||
amplitude.points.push_back({time, value});
|
||||
}
|
||||
}
|
||||
if (amplitude.points.empty()) {
|
||||
InputFailure("invalid-amplitude-data", block.location,
|
||||
block.canonical_name, *name,
|
||||
"Amplitude requires at least one finite time/value pair.");
|
||||
return;
|
||||
}
|
||||
definition_.amplitudes.push_back(std::move(amplitude));
|
||||
}
|
||||
|
||||
void ParseShellSection(const KeywordBlock& block, RawPart& part) {
|
||||
for (const auto& candidate : block.parameters) {
|
||||
if (candidate.name != "ELSET" && candidate.name != "MATERIAL") {
|
||||
@@ -1735,13 +1870,17 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
if (!ParseModelDouble(block.data[0].fields[0], material.youngs_modulus,
|
||||
block.data[0].location, block.canonical_name,
|
||||
model_element_family_ == ElementFamily::kShell
|
||||
model_element_family_ == ElementFamily::kSolid
|
||||
? "invalid-solid-material"
|
||||
: model_element_family_ == ElementFamily::kShell
|
||||
? "invalid-shell-material"
|
||||
: "invalid-beam-property",
|
||||
"Elastic material values must be finite.") ||
|
||||
!ParseModelDouble(block.data[0].fields[1], material.poisson_ratio,
|
||||
block.data[0].location, block.canonical_name,
|
||||
model_element_family_ == ElementFamily::kShell
|
||||
model_element_family_ == ElementFamily::kSolid
|
||||
? "invalid-solid-material"
|
||||
: model_element_family_ == ElementFamily::kShell
|
||||
? "invalid-shell-material"
|
||||
: "invalid-beam-property",
|
||||
"Elastic material values must be finite.")) {
|
||||
@@ -2006,6 +2145,8 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
double value = 0.0;
|
||||
if (row.fields.size() == 4U &&
|
||||
!(model_element_family_ == ElementFamily::kSolid &&
|
||||
row.fields[3].empty()) &&
|
||||
!ParseDouble(row.fields[3], value, row.location,
|
||||
block.canonical_name)) {
|
||||
return;
|
||||
@@ -2016,19 +2157,46 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
|
||||
void ParseCload(const KeywordBlock& block, std::vector<NodalLoad>& loads) {
|
||||
if (step_.dynamic && !block.parameters.empty()) {
|
||||
if (step_.dynamic && model_element_family_ != ElementFamily::kSolid &&
|
||||
!block.parameters.empty()) {
|
||||
InputFailure("unsupported-dynamic-load", block.location,
|
||||
block.canonical_name, "",
|
||||
"Dynamic CLOAD does not support keyword parameters.");
|
||||
return;
|
||||
}
|
||||
if (!ValidateParameters(block, {}) || block.data.empty()) {
|
||||
const bool solid_dynamic =
|
||||
step_.dynamic && model_element_family_ == ElementFamily::kSolid;
|
||||
if (!ValidateParameters(
|
||||
block, solid_dynamic ? std::vector<std::string_view>{"AMPLITUDE"}
|
||||
: std::vector<std::string_view>{}) ||
|
||||
block.data.empty()) {
|
||||
if (!failure_) {
|
||||
InputFailure("invalid-data-arity", block.location, block.canonical_name,
|
||||
"", "CLOAD requires one or more rows.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
std::optional<EntityIndex> amplitude_index;
|
||||
std::string amplitude_name;
|
||||
if (Parameter(block, "AMPLITUDE")) {
|
||||
const auto* name = RequiredParameterValue(block, "AMPLITUDE");
|
||||
if (!name) return;
|
||||
amplitude_name = *name;
|
||||
for (std::size_t index = 0U; index < definition_.amplitudes.size();
|
||||
++index) {
|
||||
if (AsciiCaseInsensitiveEquals(definition_.amplitudes[index].name_raw,
|
||||
*name)) {
|
||||
amplitude_index = static_cast<EntityIndex>(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!amplitude_index) {
|
||||
InputFailure("unresolved-amplitude", block.location,
|
||||
block.canonical_name, *name,
|
||||
"CLOAD amplitude must resolve to a model-level curve.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (const auto& row : block.data) {
|
||||
if (row.fields.size() != 3U || row.fields[0].empty()) {
|
||||
InputFailure("invalid-data-arity", row.location, block.canonical_name,
|
||||
@@ -2048,15 +2216,17 @@ class DomainMappingContext::Impl {
|
||||
row.fields[0], "CLOAD DOF must be in 1..6.");
|
||||
return;
|
||||
}
|
||||
if (step_.dynamic && dof > 3) {
|
||||
if ((step_.dynamic || model_element_family_ == ElementFamily::kSolid) &&
|
||||
dof > 3) {
|
||||
InputFailure("unsupported-dynamic-load", row.location,
|
||||
block.canonical_name, row.fields[1],
|
||||
"Dynamic CLOAD supports global translational DOF 1 "
|
||||
"through 3 only.");
|
||||
return;
|
||||
}
|
||||
loads.push_back(
|
||||
{row.fields[0], static_cast<int>(dof), magnitude, row.location});
|
||||
loads.push_back({row.fields[0], static_cast<int>(dof), magnitude,
|
||||
row.location, amplitude_index, amplitude_name,
|
||||
block.location});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2148,10 +2318,11 @@ class DomainMappingContext::Impl {
|
||||
return;
|
||||
}
|
||||
if (AsciiCaseInsensitiveEquals(*nlgeom_parameter->value, "YES")) {
|
||||
if (model_element_family_ != ElementFamily::kShell) {
|
||||
if (model_element_family_ != ElementFamily::kShell &&
|
||||
model_element_family_ != ElementFamily::kSolid) {
|
||||
InputFailure("unsupported-analysis-procedure", block.location,
|
||||
block.canonical_name, *nlgeom_parameter->value,
|
||||
"NLGEOM=YES requires an S4 or S4R shell model.");
|
||||
"NLGEOM=YES requires a supported Shell or Solid model.");
|
||||
return;
|
||||
}
|
||||
procedure_kind = StaticProcedureKind::kNonlinearFullNewton;
|
||||
@@ -2353,7 +2524,8 @@ class DomainMappingContext::Impl {
|
||||
return;
|
||||
}
|
||||
step_no_op_seen_ = true;
|
||||
if (step_.frequency || step_.has_heat_transfer) {
|
||||
if (step_.frequency || step_.has_heat_transfer ||
|
||||
(step_.dynamic && model_element_family_ == ElementFamily::kSolid)) {
|
||||
const auto* write = Parameter(block, "WRITE");
|
||||
const auto* frequency = Parameter(block, "FREQUENCY");
|
||||
if (!ValidateParameters(block, {"WRITE", "FREQUENCY"}) ||
|
||||
@@ -2553,18 +2725,26 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
|
||||
void ParseDynamic(const KeywordBlock& block) {
|
||||
if (step_.perturbation_explicit || !step_.nlgeom ||
|
||||
model_element_family_ != ElementFamily::kShell ||
|
||||
if (step_.perturbation_explicit ||
|
||||
(model_element_family_ != ElementFamily::kSolid &&
|
||||
(!step_.nlgeom || model_element_family_ != ElementFamily::kShell)) ||
|
||||
!ValidateParameters(block, {"DIRECT"},
|
||||
"unsupported-dynamic-parameter")) {
|
||||
if (!failure_) {
|
||||
InputFailure(
|
||||
"unsupported-analysis-procedure", block.location,
|
||||
block.canonical_name, "",
|
||||
"DYNAMIC requires the approved nonlinear shell configuration.");
|
||||
InputFailure("unsupported-analysis-procedure", block.location,
|
||||
block.canonical_name, "",
|
||||
"DYNAMIC requires nonlinear Shell or linear/nonlinear "
|
||||
"Solid geometry.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kSolid &&
|
||||
block.data.size() == 1U && block.data[0].fields.size() > 3U) {
|
||||
InputFailure("invalid-dynamic-data", block.data[0].location,
|
||||
block.canonical_name, "",
|
||||
"Solid DYNAMIC requires h,T with at most one blank field.");
|
||||
return;
|
||||
}
|
||||
const auto* direct = Parameter(block, "DIRECT");
|
||||
if (direct == nullptr || direct->value || block.data.size() != 1U ||
|
||||
block.data[0].fields.size() < 2U ||
|
||||
@@ -2622,6 +2802,7 @@ class DomainMappingContext::Impl {
|
||||
"DYNAMIC,DIRECT increment count cannot exceed STEP INC.");
|
||||
return;
|
||||
}
|
||||
dynamic.nlgeom = step_.nlgeom;
|
||||
step_.dynamic = std::move(dynamic);
|
||||
}
|
||||
|
||||
@@ -2716,6 +2897,46 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
|
||||
void ParseStatic(const KeywordBlock& block) {
|
||||
if (model_element_family_ == ElementFamily::kSolid &&
|
||||
Parameter(block, "DIRECT")) {
|
||||
if (step_.perturbation_explicit || step_.has_static || step_.frequency ||
|
||||
!ValidateParameters(block, {"DIRECT"}))
|
||||
return;
|
||||
const auto* direct = Parameter(block, "DIRECT");
|
||||
if (direct->value || block.data.size() != 1U ||
|
||||
(block.data[0].fields.size() < 2U ||
|
||||
block.data[0].fields.size() > 3U ||
|
||||
std::any_of(block.data[0].fields.begin() + 2,
|
||||
block.data[0].fields.end(),
|
||||
[](const auto& field) { return !field.empty(); }))) {
|
||||
InputFailure("invalid-static-data", block.location,
|
||||
block.canonical_name, "DIRECT",
|
||||
"STATIC DIRECT requires exactly h,T.");
|
||||
return;
|
||||
}
|
||||
double h = 0.0;
|
||||
double period = 0.0;
|
||||
if (!ParseDouble(block.data[0].fields[0], h, block.data[0].location,
|
||||
"STATIC") ||
|
||||
!ParseDouble(block.data[0].fields[1], period, block.data[0].location,
|
||||
"STATIC"))
|
||||
return;
|
||||
const double count = std::round(period / h);
|
||||
if (!(h > 0.0) || !(period > 0.0) || !std::isfinite(count) ||
|
||||
count < 1.0 ||
|
||||
count > static_cast<double>(step_.maximum_increments) ||
|
||||
h * count != period) {
|
||||
InputFailure("invalid-static-schedule", block.data[0].location,
|
||||
block.canonical_name, "DIRECT",
|
||||
"STATIC DIRECT requires positive exact N*h=T and N<=INC.");
|
||||
return;
|
||||
}
|
||||
step_.static_values = {h, period, h, h};
|
||||
step_.static_direct = true;
|
||||
step_.static_increment_count = static_cast<std::uint32_t>(count);
|
||||
step_.has_static = true;
|
||||
return;
|
||||
}
|
||||
if (step_.perturbation_explicit || step_.frequency) {
|
||||
InputFailure("unsupported-analysis-procedure", block.location,
|
||||
block.canonical_name, "PERTURBATION",
|
||||
@@ -2811,6 +3032,17 @@ class DomainMappingContext::Impl {
|
||||
"OUTPUT must select exactly FIELD or HISTORY.");
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kSolid &&
|
||||
((variable &&
|
||||
(!variable->value ||
|
||||
!AsciiCaseInsensitiveEquals(*variable->value, "PRESELECT"))) ||
|
||||
!RequireNoData(block))) {
|
||||
if (!failure_)
|
||||
InputFailure("unsupported-keyword", block.location,
|
||||
block.canonical_name, "VARIABLE",
|
||||
"Solid OUTPUT accepts only PRESELECT requests.");
|
||||
return;
|
||||
}
|
||||
if (step_.nlgeom &&
|
||||
(variable == nullptr || !variable->value ||
|
||||
!AsciiCaseInsensitiveEquals(*variable->value, "PRESELECT"))) {
|
||||
@@ -2865,6 +3097,50 @@ class DomainMappingContext::Impl {
|
||||
"Output variable keywords require an active OUTPUT request.");
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kSolid && step_.dynamic) {
|
||||
InputFailure(
|
||||
"unsupported-keyword", block.location, block.canonical_name, "",
|
||||
"Solid dynamic output children are outside the approved subset.");
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kSolid && step_.has_static) {
|
||||
const auto* variable = Parameter(block, "VARIABLE");
|
||||
const auto* directions = Parameter(block, "DIRECTIONS");
|
||||
const bool node = block.canonical_name == "NODE OUTPUT";
|
||||
const bool element = block.canonical_name == "ELEMENT OUTPUT";
|
||||
const bool contact = block.canonical_name == "CONTACT OUTPUT";
|
||||
if (!active_output_is_field_ || (!node && !element && !contact) ||
|
||||
!ValidateParameters(
|
||||
block,
|
||||
element ? std::vector<std::string_view>{"VARIABLE", "DIRECTIONS"}
|
||||
: std::vector<std::string_view>{"VARIABLE"}) ||
|
||||
(directions &&
|
||||
(!directions->value ||
|
||||
!AsciiCaseInsensitiveEquals(*directions->value, "YES"))) ||
|
||||
(variable &&
|
||||
(!variable->value ||
|
||||
!AsciiCaseInsensitiveEquals(*variable->value, "PRESELECT"))) ||
|
||||
(contact && (!variable || !block.data.empty()))) {
|
||||
if (!failure_)
|
||||
InputFailure("unsupported-keyword", block.location,
|
||||
block.canonical_name, "",
|
||||
"Solid static output child is unsupported.");
|
||||
return;
|
||||
}
|
||||
for (const auto& row : block.data) {
|
||||
for (const auto& field : row.fields) {
|
||||
const std::string token = CanonicalizeAscii(field);
|
||||
if (!(node ? (token == "U" || token == "RF")
|
||||
: (token == "S" || token == "E"))) {
|
||||
InputFailure("unsupported-keyword", row.location,
|
||||
block.canonical_name, field,
|
||||
"Solid output quantities must be physical supported "
|
||||
"components.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (step_.frequency) {
|
||||
const std::string_view required_variable =
|
||||
block.canonical_name == "NODE OUTPUT" ? "PRESELECT" : "ALL";
|
||||
@@ -3001,16 +3277,32 @@ class DomainMappingContext::Impl {
|
||||
"A material must own exactly one ELASTIC row.");
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kShell) {
|
||||
if (model_element_family_ == ElementFamily::kShell ||
|
||||
model_element_family_ == ElementFamily::kSolid) {
|
||||
if (!(material.youngs_modulus > 0.0) ||
|
||||
!(material.poisson_ratio > -1.0) ||
|
||||
!(material.poisson_ratio < 0.5)) {
|
||||
ModelFailure(
|
||||
"invalid-shell-material", material.elastic_location, "ELASTIC",
|
||||
material.name,
|
||||
"Shell isotropic elasticity requires E>0 and -1<nu<0.5.");
|
||||
ModelFailure(model_element_family_ == ElementFamily::kSolid
|
||||
? "invalid-solid-material"
|
||||
: "invalid-shell-material",
|
||||
material.elastic_location, "ELASTIC", material.name,
|
||||
"Isotropic elasticity requires E>0 and -1<nu<0.5.");
|
||||
return;
|
||||
}
|
||||
if (model_element_family_ == ElementFamily::kSolid) {
|
||||
const double mu =
|
||||
material.youngs_modulus / (2.0 * (1.0 + material.poisson_ratio));
|
||||
const double lambda = material.youngs_modulus *
|
||||
material.poisson_ratio /
|
||||
((1.0 + material.poisson_ratio) *
|
||||
(1.0 - 2.0 * material.poisson_ratio));
|
||||
if (!std::isfinite(mu) || !std::isfinite(lambda)) {
|
||||
ModelFailure("invalid-solid-material", material.elastic_location,
|
||||
"ELASTIC", material.name,
|
||||
"Solid Lame constants must be finite.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
definition_.materials.push_back({material.name, material.youngs_modulus,
|
||||
material.poisson_ratio,
|
||||
material.location});
|
||||
@@ -3063,6 +3355,16 @@ class DomainMappingContext::Impl {
|
||||
"PHYSICAL CONSTANTS is supported only by thermal input.");
|
||||
return;
|
||||
}
|
||||
if (!step_.frequency && !step_.dynamic &&
|
||||
model_element_family_ == ElementFamily::kSolid) {
|
||||
for (std::size_t index = 0U; index < materials_.size(); ++index) {
|
||||
if (materials_[index].density)
|
||||
definition_.densities.push_back({static_cast<EntityIndex>(index),
|
||||
*materials_[index].density,
|
||||
materials_[index].density_location});
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!step_.frequency && !step_.dynamic) {
|
||||
if (std::any_of(materials_.begin(), materials_.end(),
|
||||
[](const RawMaterial& material) {
|
||||
@@ -3090,10 +3392,11 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (model_element_family_ != ElementFamily::kShell) {
|
||||
if (model_element_family_ != ElementFamily::kShell &&
|
||||
model_element_family_ != ElementFamily::kSolid) {
|
||||
InputFailure("unsupported-analysis-procedure", step_.location,
|
||||
step_.frequency ? "FREQUENCY" : "DYNAMIC", step_.name_raw,
|
||||
"The procedure requires the approved shell model family.");
|
||||
"The procedure requires an approved Shell or Solid model.");
|
||||
return;
|
||||
}
|
||||
if (!element_surfaces_.empty()) {
|
||||
@@ -3112,6 +3415,10 @@ class DomainMappingContext::Impl {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const auto& section : definition_.solid_sections) {
|
||||
if (section.MaterialIndex() == static_cast<EntityIndex>(index))
|
||||
active = true;
|
||||
}
|
||||
if (active) {
|
||||
ModelFailure(
|
||||
"missing-material-density", material.location, "MATERIAL",
|
||||
@@ -3196,7 +3503,8 @@ class DomainMappingContext::Impl {
|
||||
++part_index) {
|
||||
const RawPart& part = parts_[part_index];
|
||||
if (part.nodes.empty() || part.elements.empty() ||
|
||||
(!shell_model && part.sections.empty())) {
|
||||
(!shell_model && model_element_family_ != ElementFamily::kSolid &&
|
||||
part.sections.empty())) {
|
||||
InputFailure("invalid-model-cardinality", part.location, "PART",
|
||||
part.name,
|
||||
"A part requires nodes, elements, and its approved "
|
||||
@@ -3245,6 +3553,45 @@ class DomainMappingContext::Impl {
|
||||
}
|
||||
definition_.parts.push_back(std::move(part_definition));
|
||||
|
||||
if (model_element_family_ == ElementFamily::kSolid) {
|
||||
auto& assignments = part_shell_section_assignments_[part_index];
|
||||
for (const auto& section : part.solid_sections) {
|
||||
const auto* element_set =
|
||||
FindSet(part.element_sets, section.element_set_name);
|
||||
const auto material = FindMaterialIndex(section.material_name);
|
||||
if (!element_set || !material) {
|
||||
InputFailure("unresolved-solid-section", section.location,
|
||||
"SOLID SECTION", section.element_set_name,
|
||||
"Solid ELSET and MATERIAL must resolve.");
|
||||
return;
|
||||
}
|
||||
const auto index =
|
||||
static_cast<EntityIndex>(definition_.solid_sections.size());
|
||||
definition_.solid_sections.emplace_back(
|
||||
SourceEntityId{part.name, static_cast<std::int64_t>(index),
|
||||
section.element_set_name},
|
||||
section.element_set_name, *material, section.location);
|
||||
for (const auto label : element_set->members) {
|
||||
if (!assignments.emplace(label, std::make_pair(index, *material))
|
||||
.second) {
|
||||
InputFailure(
|
||||
"invalid-solid-section-assignment", section.location,
|
||||
"SOLID SECTION", std::to_string(label),
|
||||
"Solid elements require exactly one section assignment.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto& element : part.elements) {
|
||||
if (assignments.find(element.label) == assignments.end()) {
|
||||
InputFailure("invalid-solid-section-assignment", element.location,
|
||||
"ELEMENT", element.label_text,
|
||||
"A Solid section assignment is missing.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (shell_model) {
|
||||
auto& assignments = part_shell_section_assignments_[part_index];
|
||||
for (const auto& section : part.shell_sections) {
|
||||
@@ -3475,6 +3822,36 @@ class DomainMappingContext::Impl {
|
||||
assignment->second.second,
|
||||
assignment->second.first,
|
||||
raw_element.location});
|
||||
} else if (raw_element.type == RawElement::Type::kC3d8) {
|
||||
std::array<EntityIndex, 8> connected_nodes{};
|
||||
for (std::size_t node = 0U; node < connected_nodes.size(); ++node) {
|
||||
const auto found = node_indices.find(raw_element.node_labels[node]);
|
||||
if (found == node_indices.end()) {
|
||||
InputFailure("invalid-solid-connectivity", raw_element.location,
|
||||
"ELEMENT", raw_element.label_text,
|
||||
"Solid nodes must resolve.");
|
||||
return;
|
||||
}
|
||||
connected_nodes[node] = found->second;
|
||||
}
|
||||
const auto& assignments =
|
||||
part_shell_section_assignments_[PartIndex(*part)];
|
||||
const auto assignment = assignments.find(raw_element.label);
|
||||
if (assignment == assignments.end() ||
|
||||
definition_.solid_elements.size() >
|
||||
std::numeric_limits<EntityIndex>::max()) {
|
||||
InputFailure("invalid-solid-section-assignment",
|
||||
raw_element.location, "ELEMENT",
|
||||
raw_element.label_text,
|
||||
"Solid assignment must resolve.");
|
||||
return;
|
||||
}
|
||||
index = static_cast<EntityIndex>(definition_.solid_elements.size());
|
||||
definition_.solid_elements.emplace_back(
|
||||
SourceEntityId{raw_instance.name, raw_element.label,
|
||||
raw_element.label_text},
|
||||
connected_nodes, assignment->second.second,
|
||||
assignment->second.first, raw_element.location);
|
||||
} else {
|
||||
std::array<EntityIndex, 4> connected_nodes{};
|
||||
for (std::size_t node = 0U; node < connected_nodes.size(); ++node) {
|
||||
@@ -4048,6 +4425,47 @@ class DomainMappingContext::Impl {
|
||||
const SourceTargetIndex target_index = BuildSourceTargetIndex();
|
||||
const SourceTargetResolver target_resolver{target_index};
|
||||
|
||||
if (model_element_family_ == ElementFamily::kSolid) {
|
||||
std::vector<PrescribedDisplacementDefinition> physical;
|
||||
for (auto boundary : boundaries) {
|
||||
if (!ResolveNodeTarget(target_resolver, boundary.target,
|
||||
boundary.location, "BOUNDARY"))
|
||||
return;
|
||||
if (boundary.last_dof > 3) {
|
||||
if (boundary.value != 0.0) {
|
||||
InputFailure("unsupported-solid-rotation-boundary",
|
||||
boundary.location, "BOUNDARY", boundary.target,
|
||||
"Solid rotational boundaries must be exact zero to be "
|
||||
"inactive.");
|
||||
return;
|
||||
}
|
||||
definition_.warnings.push_back(
|
||||
{Severity::kWarning, "inactive-solid-rotation-boundary",
|
||||
boundary.location, "BOUNDARY", boundary.target,
|
||||
"Exact-zero rotational boundary DOFs " +
|
||||
std::to_string(std::max(4, boundary.first_dof)) + ".." +
|
||||
std::to_string(boundary.last_dof) +
|
||||
" are inactive; Solid equations contain translations "
|
||||
"only."});
|
||||
boundary.last_dof = 3;
|
||||
}
|
||||
if (boundary.first_dof <= boundary.last_dof)
|
||||
physical.push_back(std::move(boundary));
|
||||
}
|
||||
boundaries = std::move(physical);
|
||||
std::vector<bool> active(definition_.nodes.size(), false);
|
||||
for (const auto& element : definition_.solid_elements)
|
||||
for (const auto node : element.node_indices) active[node] = true;
|
||||
for (std::size_t node = 0U; node < active.size(); ++node) {
|
||||
if (!active[node]) {
|
||||
ModelFailure("unused-solid-node", definition_.nodes[node].location,
|
||||
"NODE",
|
||||
definition_.nodes[node].source_id.source_label_text,
|
||||
"Every Solid node must connect to a C3D8 element.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::map<std::pair<EntityIndex, int>, double> prescribed_values;
|
||||
for (const auto& boundary : boundaries) {
|
||||
auto target = ResolveNodeTarget(target_resolver, boundary.target,
|
||||
@@ -4115,10 +4533,15 @@ class DomainMappingContext::Impl {
|
||||
// Static time-control values are provenance only: V0 creates exactly
|
||||
// the canonical final frame 0 and performs no increment loop here.
|
||||
definition_.steps.push_back(
|
||||
{"Step-1", std::move(boundaries), step_.loads,
|
||||
std::move(surface_pressure_loads), step_.procedure_kind, step_.nlgeom,
|
||||
step_.static_values[0], step_.static_values[1], step_.static_values[2],
|
||||
step_.static_values[3], step_.location});
|
||||
{model_element_family_ == ElementFamily::kSolid ? step_.name_raw
|
||||
: "Step-1",
|
||||
std::move(boundaries), step_.loads, std::move(surface_pressure_loads),
|
||||
step_.procedure_kind, step_.nlgeom, step_.static_values[0],
|
||||
step_.static_values[1], step_.static_values[2], step_.static_values[3],
|
||||
step_.location});
|
||||
definition_.steps.back().direct = step_.static_direct;
|
||||
definition_.steps.back().increment_count = step_.static_increment_count;
|
||||
definition_.steps.back().maximum_increments = step_.maximum_increments;
|
||||
}
|
||||
|
||||
const ParsedInput& input_;
|
||||
|
||||
@@ -30,15 +30,18 @@ ConcentratedNodalLoad::ConcentratedNodalLoad(
|
||||
global_components_{global_components},
|
||||
source_order_{source_order} {}
|
||||
|
||||
ConcentratedNodalLoad::ConcentratedNodalLoad(SourceTargetQuery target,
|
||||
const int source_dof,
|
||||
const double magnitude,
|
||||
const std::size_t source_order,
|
||||
SourceLocation location)
|
||||
ConcentratedNodalLoad::ConcentratedNodalLoad(
|
||||
SourceTargetQuery target, const int source_dof, const double magnitude,
|
||||
const std::size_t source_order, SourceLocation location,
|
||||
std::optional<EntityIndex> amplitude_index, std::string amplitude_name_raw,
|
||||
SourceLocation amplitude_location)
|
||||
: target_{std::move(target)},
|
||||
source_order_{source_order},
|
||||
location_{std::move(location)},
|
||||
source_dof_{source_dof} {
|
||||
source_dof_{source_dof},
|
||||
amplitude_index_{amplitude_index},
|
||||
amplitude_name_raw_{std::move(amplitude_name_raw)},
|
||||
amplitude_location_{std::move(amplitude_location)} {
|
||||
if (source_dof >= 1 && source_dof <= static_cast<int>(kDofsPerNode)) {
|
||||
global_components_[static_cast<std::size_t>(source_dof - 1)] = magnitude;
|
||||
}
|
||||
@@ -47,6 +50,33 @@ ConcentratedNodalLoad::ConcentratedNodalLoad(SourceTargetQuery target,
|
||||
Result<std::vector<LoadContribution>>
|
||||
ConcentratedNodalLoad::ComputeContributions(const LoadContext& context) const {
|
||||
const std::string& identity = target_.target_name_or_label;
|
||||
const std::size_t components = context.dof_manager.ComponentsPerNode();
|
||||
if (context.dof_manager.Profile() == DofProfile::kThermal ||
|
||||
(source_dof_ != 0 && source_dof_ > static_cast<int>(components))) {
|
||||
return Result<std::vector<LoadContribution>>::Failure(LoadFailure(
|
||||
"invalid-load-dof", location_, identity,
|
||||
"The source load component is inactive for this physical profile."));
|
||||
}
|
||||
for (std::size_t component = components; component < kDofsPerNode;
|
||||
++component) {
|
||||
if (global_components_[component] != 0.0) {
|
||||
return Result<std::vector<LoadContribution>>::Failure(
|
||||
LoadFailure("invalid-load-dof", location_, identity,
|
||||
"A Solid load cannot contain rotational components."));
|
||||
}
|
||||
}
|
||||
double amplitude = 1.0;
|
||||
if (amplitude_index_) {
|
||||
if (!context.domain.IsSolid() || context.domain.Dynamic() == nullptr ||
|
||||
*amplitude_index_ >= context.domain.Amplitudes().size() ||
|
||||
!std::isfinite(context.step_time) || context.step_time < 0.0) {
|
||||
return Result<std::vector<LoadContribution>>::Failure(
|
||||
LoadFailure("invalid-load-amplitude", location_, identity,
|
||||
"Amplitude requires a valid Solid dynamic endpoint."));
|
||||
}
|
||||
amplitude = context.domain.Amplitudes()[*amplitude_index_].Evaluate(
|
||||
context.step_time);
|
||||
}
|
||||
if (source_dof_ != 0 &&
|
||||
(source_dof_ < 1 || source_dof_ > static_cast<int>(kDofsPerNode))) {
|
||||
return Result<std::vector<LoadContribution>>::Failure(LoadFailure(
|
||||
@@ -76,7 +106,7 @@ ConcentratedNodalLoad::ComputeContributions(const LoadContext& context) const {
|
||||
|
||||
std::vector<unsigned char> seen(context.domain.Nodes().size(), 0U);
|
||||
std::vector<LoadContribution> contributions;
|
||||
contributions.reserve(resolved.Value().size() * kDofsPerNode);
|
||||
contributions.reserve(resolved.Value().size() * components);
|
||||
for (const auto& target : resolved.Value()) {
|
||||
const EntityIndex node = target.entity_index;
|
||||
if (node >= context.domain.Nodes().size() || seen[node] != 0U) {
|
||||
@@ -86,13 +116,19 @@ ConcentratedNodalLoad::ComputeContributions(const LoadContext& context) const {
|
||||
"identities."));
|
||||
}
|
||||
seen[node] = 1U;
|
||||
for (std::size_t component = 0U; component < kDofsPerNode; ++component) {
|
||||
for (std::size_t component = 0U; component < components; ++component) {
|
||||
const double value = global_components_[component] * amplitude;
|
||||
if (!std::isfinite(value)) {
|
||||
return Result<std::vector<LoadContribution>>::Failure(
|
||||
LoadFailure("nonfinite-load-value", location_, identity,
|
||||
"Sampled load magnitude must remain finite."));
|
||||
}
|
||||
try {
|
||||
contributions.push_back(
|
||||
{source_order_,
|
||||
context.dof_manager.FullDof(node,
|
||||
static_cast<DofComponent>(component)),
|
||||
global_components_[component]});
|
||||
value});
|
||||
} catch (const std::out_of_range&) {
|
||||
return Result<std::vector<LoadContribution>>::Failure(LoadFailure(
|
||||
"invalid-load-target", location_, identity,
|
||||
|
||||
+244
-11
@@ -1,10 +1,13 @@
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -48,12 +51,14 @@ Status ValidateThermalTargets(
|
||||
|
||||
Status ValidateThermalDefinition(const ModelDefinition& definition) {
|
||||
const bool has_structural = !definition.elements.empty() ||
|
||||
!definition.shell_elements.empty();
|
||||
const bool has_thermal_data = !definition.thermal_materials.empty() ||
|
||||
!definition.thermal_sections.empty() ||
|
||||
definition.thermal_step.has_value() ||
|
||||
!definition.thermal_initial_conditions.empty() ||
|
||||
!definition.thermal_model_boundaries.empty();
|
||||
!definition.shell_elements.empty() ||
|
||||
!definition.solid_elements.empty();
|
||||
const bool has_thermal_data =
|
||||
!definition.thermal_materials.empty() ||
|
||||
!definition.thermal_sections.empty() ||
|
||||
definition.thermal_step.has_value() ||
|
||||
!definition.thermal_initial_conditions.empty() ||
|
||||
!definition.thermal_model_boundaries.empty();
|
||||
if (has_structural && !definition.thermal_elements.empty()) {
|
||||
return InvalidThermalDefinition({}, "DS4",
|
||||
"Structural and DS4 elements cannot mix.");
|
||||
@@ -161,6 +166,180 @@ Status ValidateThermalDefinition(const ModelDefinition& definition) {
|
||||
return Status::Ok();
|
||||
}
|
||||
|
||||
/// @brief Checks Solid semantic candidates before immutable ownership starts.
|
||||
Status ValidateSolidDefinition(ModelDefinition& definition) {
|
||||
const auto fail = [](const SourceLocation& location,
|
||||
const std::string& identity,
|
||||
const std::string& message) {
|
||||
return Status::Failure(FailureCategory::kModel,
|
||||
{{Severity::kError, "invalid-solid-definition",
|
||||
location, "SOLID", identity, message}});
|
||||
};
|
||||
if (definition.solid_elements.empty()) {
|
||||
if (!definition.solid_sections.empty() || !definition.amplitudes.empty())
|
||||
return fail({}, "C3D8", "Solid definitions require a C3D8 model.");
|
||||
return Status::Ok();
|
||||
}
|
||||
if (!definition.elements.empty() || !definition.shell_elements.empty() ||
|
||||
!definition.thermal_elements.empty() || definition.thermal_step ||
|
||||
!definition.sections.empty() || !definition.shell_sections.empty() ||
|
||||
!definition.element_surfaces.empty()) {
|
||||
return fail({}, "C3D8",
|
||||
"Solid models cannot mix element or section families.");
|
||||
}
|
||||
if (definition.steps.size() + (definition.frequency_step ? 1U : 0U) +
|
||||
(definition.dynamic_step ? 1U : 0U) !=
|
||||
1U) {
|
||||
return fail({}, "STEP", "Solid models require exactly one procedure.");
|
||||
}
|
||||
std::vector<bool> active(definition.nodes.size(), false);
|
||||
std::set<std::pair<std::string, std::int64_t>> node_ids;
|
||||
for (const auto& node : definition.nodes) {
|
||||
if (!node_ids
|
||||
.emplace(node.source_id.instance_name, node.source_id.source_label)
|
||||
.second)
|
||||
return fail(node.location, node.source_id.source_label_text,
|
||||
"Node identity is duplicated.");
|
||||
for (const double coordinate : node.coordinates)
|
||||
if (!std::isfinite(coordinate))
|
||||
return fail(node.location, node.source_id.source_label_text,
|
||||
"Solid coordinates must be finite.");
|
||||
}
|
||||
std::set<std::pair<std::string, std::int64_t>> element_ids;
|
||||
std::set<EntityIndex> active_materials;
|
||||
for (const auto& element : definition.solid_elements) {
|
||||
if (!element_ids
|
||||
.emplace(element.source_id.instance_name,
|
||||
element.source_id.source_label)
|
||||
.second ||
|
||||
element.section_index >= definition.solid_sections.size() ||
|
||||
element.material_index >= definition.materials.size()) {
|
||||
return fail(
|
||||
element.location, element.source_id.source_label_text,
|
||||
"Solid identity, section, and material must resolve uniquely.");
|
||||
}
|
||||
if (definition.solid_sections[element.section_index].MaterialIndex() !=
|
||||
element.material_index)
|
||||
return fail(element.location, element.source_id.source_label_text,
|
||||
"Solid material assignment conflicts.");
|
||||
active_materials.insert(element.material_index);
|
||||
std::set<EntityIndex> distinct;
|
||||
for (const auto node : element.node_indices) {
|
||||
if (node >= active.size() || !distinct.insert(node).second)
|
||||
return fail(element.location, element.source_id.source_label_text,
|
||||
"Solid connectivity requires eight distinct active nodes.");
|
||||
active[node] = true;
|
||||
}
|
||||
}
|
||||
for (std::size_t node = 0U; node < active.size(); ++node)
|
||||
if (!active[node])
|
||||
return fail(definition.nodes[node].location,
|
||||
definition.nodes[node].source_id.source_label_text,
|
||||
"Solid nodes must be connected.");
|
||||
for (const auto& section : definition.solid_sections)
|
||||
if (section.MaterialIndex() >= definition.materials.size() ||
|
||||
section.Name().empty())
|
||||
return fail(section.Location(), section.Name(),
|
||||
"Solid material assignment is invalid.");
|
||||
for (const auto index : active_materials) {
|
||||
const auto& material = definition.materials[index];
|
||||
const double young = material.YoungsModulus();
|
||||
const double nu = material.PoissonsRatio();
|
||||
const double mu = young / (2.0 * (1.0 + nu));
|
||||
const double lambda = young * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
|
||||
if (!std::isfinite(young) || !(young > 0.0) || !std::isfinite(nu) ||
|
||||
!(nu > -1.0 && nu < 0.5) || !std::isfinite(mu) ||
|
||||
!std::isfinite(lambda))
|
||||
return fail(material.Location(), material.Name(),
|
||||
"Solid isotropic constants are invalid.");
|
||||
}
|
||||
std::set<EntityIndex> density_materials;
|
||||
for (const auto& density : definition.densities) {
|
||||
if (density.material_index >= definition.materials.size() ||
|
||||
!std::isfinite(density.rho) || !(density.rho > 0.0) ||
|
||||
!density_materials.insert(density.material_index).second)
|
||||
return fail(density.location, "DENSITY",
|
||||
"Solid density must be finite positive and unique.");
|
||||
}
|
||||
if (definition.dynamic_step || definition.frequency_step)
|
||||
for (const auto material : active_materials)
|
||||
if (density_materials.count(material) == 0U)
|
||||
return fail({}, "DENSITY",
|
||||
"Solid frequency and dynamic materials require density.");
|
||||
std::set<std::string> amplitude_names;
|
||||
for (const auto& amplitude : definition.amplitudes) {
|
||||
if (!definition.dynamic_step || amplitude.name_raw.empty() ||
|
||||
amplitude.name_canonical.empty() ||
|
||||
!amplitude_names.insert(amplitude.name_canonical).second ||
|
||||
amplitude.points.empty())
|
||||
return fail(amplitude.location, amplitude.name_raw,
|
||||
"Solid amplitude identity is invalid.");
|
||||
double previous = -1.0;
|
||||
for (const auto& point : amplitude.points) {
|
||||
if (!std::isfinite(point[0]) || !std::isfinite(point[1]) ||
|
||||
point[0] < 0.0 || !(point[0] > previous))
|
||||
return fail(amplitude.location, amplitude.name_raw,
|
||||
"Solid amplitude pairs are invalid.");
|
||||
previous = point[0];
|
||||
}
|
||||
}
|
||||
const auto validate_boundaries = [&fail](const auto& boundaries,
|
||||
bool homogeneous) {
|
||||
for (const auto& boundary : boundaries) {
|
||||
if (boundary.first_dof < 1 || boundary.last_dof < boundary.first_dof ||
|
||||
boundary.last_dof > 3 || !std::isfinite(boundary.value) ||
|
||||
(homogeneous && boundary.value != 0.0))
|
||||
return fail(boundary.location, boundary.target,
|
||||
"Solid physical boundaries require DOF1..3.");
|
||||
}
|
||||
return Status::Ok();
|
||||
};
|
||||
const auto validate_loads = [&fail, &definition](const auto& loads,
|
||||
bool dynamic) {
|
||||
for (const auto& load : loads) {
|
||||
if (load.dof < 1 || load.dof > 3 || !std::isfinite(load.magnitude) ||
|
||||
(load.amplitude_index &&
|
||||
(!dynamic || *load.amplitude_index >= definition.amplitudes.size())))
|
||||
return fail(load.location, load.target,
|
||||
"Solid load component or amplitude is invalid.");
|
||||
}
|
||||
return Status::Ok();
|
||||
};
|
||||
if (definition.frequency_step)
|
||||
return validate_boundaries(definition.frequency_step->boundaries, true);
|
||||
if (definition.dynamic_step) {
|
||||
const auto& dynamic = *definition.dynamic_step;
|
||||
if (!std::isfinite(dynamic.initial_increment) ||
|
||||
!(dynamic.initial_increment > 0.0) ||
|
||||
!std::isfinite(dynamic.time_period) || !(dynamic.time_period > 0.0) ||
|
||||
dynamic.increment_count == 0U ||
|
||||
dynamic.increment_count > dynamic.maximum_increments ||
|
||||
dynamic.initial_increment *
|
||||
static_cast<double>(dynamic.increment_count) !=
|
||||
dynamic.time_period ||
|
||||
dynamic.alpha != -0.05 || dynamic.beta != 0.275625 ||
|
||||
dynamic.gamma != 0.55)
|
||||
return fail(dynamic.data_location, dynamic.source_step_name_raw,
|
||||
"Solid dynamic controls are invalid.");
|
||||
const auto status = validate_boundaries(dynamic.boundaries, true);
|
||||
if (!status.IsOk()) return status;
|
||||
return validate_loads(dynamic.loads, true);
|
||||
}
|
||||
const auto& step = definition.steps[0];
|
||||
if (step.direct &&
|
||||
(!std::isfinite(step.initial_increment) ||
|
||||
!(step.initial_increment > 0.0) || !std::isfinite(step.time_period) ||
|
||||
!(step.time_period > 0.0) || step.increment_count == 0U ||
|
||||
step.increment_count > step.maximum_increments ||
|
||||
step.initial_increment * static_cast<double>(step.increment_count) !=
|
||||
step.time_period))
|
||||
return fail(step.location, step.name,
|
||||
"Solid static fixed schedule is invalid.");
|
||||
const auto status = validate_boundaries(step.boundaries, false);
|
||||
if (!status.IsOk()) return status;
|
||||
return validate_loads(step.loads, false);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
StepDefinition::StepDefinition(StaticStepDefinition definition)
|
||||
@@ -192,12 +371,17 @@ StepDefinition::StepDefinition(StaticStepDefinition definition)
|
||||
auto& load = definition.loads[source_order];
|
||||
auto owned = std::make_unique<ConcentratedNodalLoad>(
|
||||
SourceTargetQuery{SourceEntityKind::kNode, "", load.target}, load.dof,
|
||||
load.magnitude, source_order, std::move(load.location));
|
||||
load.magnitude, source_order, std::move(load.location),
|
||||
load.amplitude_index, std::move(load.amplitude_name_raw),
|
||||
std::move(load.amplitude_location));
|
||||
loads_view_.push_back(std::cref(*owned));
|
||||
concentrated_loads_view_.Add(*owned);
|
||||
loads_.push_back(std::move(owned));
|
||||
}
|
||||
surface_pressure_loads_ = std::move(definition.surface_pressure_loads);
|
||||
direct_static_ = definition.direct;
|
||||
increment_count_ = definition.increment_count;
|
||||
maximum_increments_ = definition.maximum_increments;
|
||||
}
|
||||
|
||||
StepDefinition::StepDefinition(FrequencyStepDefinition definition)
|
||||
@@ -227,8 +411,10 @@ StepDefinition::StepDefinition(FrequencyStepDefinition definition)
|
||||
|
||||
StepDefinition::StepDefinition(DynamicStepDefinition definition)
|
||||
: name_{definition.source_step_name_raw},
|
||||
procedure_kind_{StaticProcedureKind::kNonlinearFullNewton},
|
||||
nlgeom_{true},
|
||||
procedure_kind_{definition.nlgeom
|
||||
? StaticProcedureKind::kNonlinearFullNewton
|
||||
: StaticProcedureKind::kLinearSmallDisplacement},
|
||||
nlgeom_{definition.nlgeom},
|
||||
initial_increment_{definition.initial_increment},
|
||||
time_period_{definition.time_period},
|
||||
minimum_increment_{definition.initial_increment},
|
||||
@@ -255,7 +441,9 @@ StepDefinition::StepDefinition(DynamicStepDefinition definition)
|
||||
auto& load = dynamic_->loads[source_order];
|
||||
auto owned = std::make_unique<ConcentratedNodalLoad>(
|
||||
SourceTargetQuery{SourceEntityKind::kNode, "", load.target}, load.dof,
|
||||
load.magnitude, source_order, std::move(load.location));
|
||||
load.magnitude, source_order, std::move(load.location),
|
||||
load.amplitude_index, std::move(load.amplitude_name_raw),
|
||||
std::move(load.amplitude_location));
|
||||
loads_view_.push_back(std::cref(*owned));
|
||||
concentrated_loads_view_.Add(*owned);
|
||||
loads_.push_back(std::move(owned));
|
||||
@@ -325,11 +513,21 @@ double StepDefinition::MaximumIncrement() const noexcept {
|
||||
return maximum_increment_;
|
||||
}
|
||||
|
||||
bool StepDefinition::IsDirectStatic() const noexcept { return direct_static_; }
|
||||
std::uint32_t StepDefinition::IncrementCount() const noexcept {
|
||||
return increment_count_;
|
||||
}
|
||||
std::uint32_t StepDefinition::MaximumIncrements() const noexcept {
|
||||
return maximum_increments_;
|
||||
}
|
||||
|
||||
const SourceLocation& StepDefinition::Location() const noexcept {
|
||||
return location_;
|
||||
}
|
||||
|
||||
Result<Domain> Domain::Create(ModelDefinition definition) {
|
||||
const Status solid_status = ValidateSolidDefinition(definition);
|
||||
if (!solid_status.IsOk()) return Result<Domain>::Failure(solid_status);
|
||||
const Status thermal_status = ValidateThermalDefinition(definition);
|
||||
if (!thermal_status.IsOk()) return Result<Domain>::Failure(thermal_status);
|
||||
return Result<Domain>::Success(Domain{std::move(definition)});
|
||||
@@ -354,6 +552,23 @@ const DomainCollectionView<Mitc4ShellDefinition>& Domain::ShellElements()
|
||||
return shell_elements_view_;
|
||||
}
|
||||
|
||||
const DomainCollectionView<Hex8Definition>& Domain::SolidElements()
|
||||
const noexcept {
|
||||
return solid_elements_view_;
|
||||
}
|
||||
const DomainCollectionView<SolidSection>& Domain::SolidSections()
|
||||
const noexcept {
|
||||
return solid_sections_view_;
|
||||
}
|
||||
bool Domain::IsSolid() const noexcept {
|
||||
return !solid_elements_view_.Empty() &&
|
||||
solid_elements_view_.Size() == elements_view_.Size();
|
||||
}
|
||||
const std::vector<TabularAmplitudeDefinition>& Domain::Amplitudes()
|
||||
const noexcept {
|
||||
return definition_.amplitudes;
|
||||
}
|
||||
|
||||
const DomainCollectionView<Material>& Domain::Materials() const noexcept {
|
||||
return materials_view_;
|
||||
}
|
||||
@@ -496,6 +711,14 @@ Domain::Domain(ModelDefinition definition)
|
||||
element_properties_.push_back(std::move(owned));
|
||||
}
|
||||
definition_.shell_sections.clear();
|
||||
const std::size_t solid_property_offset = element_properties_.size();
|
||||
for (auto& section : definition_.solid_sections) {
|
||||
auto owned = std::make_unique<SolidSection>(std::move(section));
|
||||
properties_view_.Add(*owned);
|
||||
solid_sections_view_.Add(*owned);
|
||||
element_properties_.push_back(std::move(owned));
|
||||
}
|
||||
definition_.solid_sections.clear();
|
||||
|
||||
element_definitions_.reserve(definition_.elements.size() +
|
||||
definition_.shell_elements.size());
|
||||
@@ -517,6 +740,16 @@ Domain::Domain(ModelDefinition definition)
|
||||
element_definitions_.push_back(std::move(owned));
|
||||
}
|
||||
definition_.shell_elements.clear();
|
||||
for (auto& element : definition_.solid_elements) {
|
||||
element.SynchronizeNodeIndices();
|
||||
element.SetPropertyIndex(static_cast<EntityIndex>(solid_property_offset +
|
||||
element.section_index));
|
||||
auto owned = std::make_unique<Hex8Definition>(std::move(element));
|
||||
elements_view_.Add(*owned);
|
||||
solid_elements_view_.Add(*owned);
|
||||
element_definitions_.push_back(std::move(owned));
|
||||
}
|
||||
definition_.solid_elements.clear();
|
||||
for (auto& element : definition_.thermal_elements) {
|
||||
const EntityIndex material_index = static_cast<EntityIndex>(
|
||||
structural_material_count +
|
||||
|
||||
Reference in New Issue
Block a user