Integrate Refactor solver sources and dual MSVC CMake builds
This commit is contained in:
@@ -151,9 +151,24 @@ Result<std::vector<RuntimeShell>> BuildRuntimeShells(const Domain& domain,
|
||||
*material, density);
|
||||
if (!inertia.HasValue())
|
||||
return Result<std::vector<RuntimeShell>>::Failure(inertia.GetStatus());
|
||||
shells.push_back({static_cast<EntityIndex>(index),
|
||||
dofs.ShellElementScatter(static_cast<EntityIndex>(index)),
|
||||
std::move(internal.Value()), std::move(inertia.Value())});
|
||||
auto internal_kernel =
|
||||
std::make_unique<NonlinearMitc4Shell>(std::move(internal.Value()));
|
||||
auto inertia_kernel =
|
||||
std::make_unique<NonlinearMitc4Inertia>(std::move(inertia.Value()));
|
||||
ElementDofLayout layout{
|
||||
definition->SourceId(), definition->NodeIndices(),
|
||||
{DofComponent::kUx, DofComponent::kUy, DofComponent::kUz,
|
||||
DofComponent::kUrx, DofComponent::kUry, DofComponent::kUrz}};
|
||||
auto trial = std::make_unique<Mitc4TrialAdapter>(layout, *internal_kernel);
|
||||
auto kinetic = std::make_unique<Mitc4InertiaAdapter>(layout, *inertia_kernel);
|
||||
auto mapped = dofs.ElementScatter(kinetic->DofLayout());
|
||||
if (!mapped.HasValue())
|
||||
return Result<std::vector<RuntimeShell>>::Failure(mapped.GetStatus());
|
||||
std::array<std::size_t, 24> scatter{};
|
||||
std::copy(mapped.Value().begin(), mapped.Value().end(), scatter.begin());
|
||||
shells.push_back({static_cast<EntityIndex>(index), scatter,
|
||||
std::move(internal_kernel), std::move(inertia_kernel),
|
||||
std::move(trial), std::move(kinetic)});
|
||||
}
|
||||
return Result<std::vector<RuntimeShell>>::Success(std::move(shells));
|
||||
}
|
||||
@@ -431,8 +446,8 @@ Result<DynamicAssembly> EvaluateAssembly(
|
||||
}
|
||||
const auto before = retain_constraints ? ReadTrialEvaluationContext()
|
||||
: TrialEvaluationContext{};
|
||||
auto f = EvaluateInternalResidualAndTangent(
|
||||
shells[e].internal, trial, directional_third ? &v : nullptr);
|
||||
auto f = shells[e].internal->EvaluateTrial(
|
||||
trial, directional_third ? &v : nullptr);
|
||||
if (!f.HasValue()) {
|
||||
failures[e] = f.GetStatus();
|
||||
return;
|
||||
@@ -441,7 +456,7 @@ Result<DynamicAssembly> EvaluateAssembly(
|
||||
const auto after = ReadTrialEvaluationContext();
|
||||
if (ReusableTrialContext(before, after)) evaluation_contexts[e] = after;
|
||||
}
|
||||
auto m = shells[e].inertia.Evaluate(trial, v, a);
|
||||
auto m = shells[e].inertia->Evaluate(trial, v, a);
|
||||
if (!m.HasValue()) {
|
||||
failures[e] = m.GetStatus();
|
||||
return;
|
||||
@@ -499,7 +514,7 @@ Result<DynamicAssembly> EvaluateAssembly(
|
||||
external_done[node] = true;
|
||||
const auto first = 6U * node + 3U;
|
||||
const auto external =
|
||||
shells[e].internal.EvaluateExternalDrillingConstraint(
|
||||
shells[e].internal->EvaluateExternalDrillingConstraint(
|
||||
local, Triple(frame.generalized_coordinates, first),
|
||||
Triple(frame.velocity, first),
|
||||
Triple(frame.external_force, first), {}, {});
|
||||
@@ -660,7 +675,7 @@ Result<DynamicAssembly> EvaluateAssembly(
|
||||
record.scatter = shells[e].scatter;
|
||||
record.configuration =
|
||||
nonlinear_mitc4_internal::ConfigurationSnapshot::Read(
|
||||
shells[e].internal);
|
||||
*shells[e].internal_kernel);
|
||||
record.evaluation_context = evaluation_contexts[e];
|
||||
for (std::size_t i = 0U; i < 24U; ++i) {
|
||||
record.q[i] = frame.generalized_coordinates[shells[e].scatter[i]];
|
||||
@@ -703,11 +718,13 @@ Status CompleteEquilibrium(const Domain& domain, const DofManager& dofs,
|
||||
const auto first = 6U * node;
|
||||
const Vector3 arm = Vector3(domain.Nodes()[node].coordinates) +
|
||||
Triple(frame->generalized_coordinates, first);
|
||||
const Matrix transform = InverseTransposeLeftJacobianSO3(
|
||||
Triple(frame->generalized_coordinates, first + 3U));
|
||||
const Vector3 phi = Triple(frame->generalized_coordinates, first + 3U);
|
||||
for (const Vector* values : {&frame->external_force, &frame->reaction}) {
|
||||
const Vector3 force = Triple(*values, first);
|
||||
const Vector3 moment = Transform(transform, Triple(*values, first + 3U));
|
||||
const auto spatial = SpatialMomentSO3(phi, Triple(*values, first + 3U));
|
||||
if (!spatial.HasValue())
|
||||
return Failure("Dynamic physical force or moment balance exceeds 1e-8.");
|
||||
const Vector3 moment = spatial.Value();
|
||||
total_force = total_force + force;
|
||||
total_moment = total_moment + arm.Cross(force) + moment;
|
||||
force_scale += force.Norm();
|
||||
|
||||
Reference in New Issue
Block a user