#include "fesa/analysis/analysis_state.hpp"

#include <utility>

namespace fesa {

AnalysisState AnalysisState::create(
    const DofManager& dofs, StepFrameIdentity identity) {
    return AnalysisState{dofs.fullDofCount(), std::move(identity)};
}

Vector& AnalysisState::displacement() noexcept {
    return displacement_;
}

const Vector& AnalysisState::displacement() const noexcept {
    return displacement_;
}

Vector& AnalysisState::externalForce() noexcept {
    return externalForce_;
}

const Vector& AnalysisState::externalForce() const noexcept {
    return externalForce_;
}

Vector& AnalysisState::internalForce() noexcept {
    return internalForce_;
}

const Vector& AnalysisState::internalForce() const noexcept {
    return internalForce_;
}

Vector& AnalysisState::residual() noexcept {
    return residual_;
}

const Vector& AnalysisState::residual() const noexcept {
    return residual_;
}

Vector& AnalysisState::reaction() noexcept {
    return reaction_;
}

const Vector& AnalysisState::reaction() const noexcept {
    return reaction_;
}

const StepFrameIdentity& AnalysisState::identity() const noexcept {
    return identity_;
}

std::vector<EndpointResultRow>& AnalysisState::endpointResults() noexcept {
    return endpointResults_;
}

const std::vector<EndpointResultRow>& AnalysisState::endpointResults() const noexcept {
    return endpointResults_;
}

std::vector<GaussResultRow>& AnalysisState::gaussResults() noexcept {
    return gaussResults_;
}

const std::vector<GaussResultRow>& AnalysisState::gaussResults() const noexcept {
    return gaussResults_;
}

std::vector<StressS11Row>& AnalysisState::stressResults() noexcept {
    return stressResults_;
}

const std::vector<StressS11Row>& AnalysisState::stressResults() const noexcept {
    return stressResults_;
}

AnalysisState::AnalysisState(
    std::size_t fullDofCount, StepFrameIdentity identity)
    : identity_{std::move(identity)},
      displacement_{fullDofCount},
      externalForce_{fullDofCount},
      internalForce_{fullDofCount},
      residual_{fullDofCount},
      reaction_{fullDofCount} {}

} // namespace fesa
