Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove matching information from IDA and KINSOL #18

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions include/marco/Runtime/Solvers/IDA/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ class IDAInstance {

/// Add the information about an equation that is handled by IDA.
Equation addEquation(const int64_t *ranges, uint64_t rank,
Variable writtenVariable,
AccessFunction writeAccessFunction,
const char *stringRepresentation);

void addVariableAccess(Equation equation, Variable variableIndex,
Expand Down Expand Up @@ -157,10 +155,6 @@ class IDAInstance {

[[nodiscard]] uint64_t getEquationFlatSize(Equation equation) const;

[[nodiscard]] Variable getWrittenVariable(Equation equation) const;

[[nodiscard]] AccessFunction getWriteAccessFunction(Equation equation) const;

[[nodiscard]] uint64_t getVariableRank(Variable variable) const;

void
Expand Down Expand Up @@ -224,17 +218,6 @@ class IDAInstance {
bool idaSetMaxNumItersIC();
bool idaSetLineSearchOffIC();

/// }
/// @name Utility functions
/// {

/// Get the scalar equation writing to a certain scalar variable.
/// Warning: extremely slow, to be used only for debug purposes.
void getWritingEquation(Variable variable,
const std::vector<uint64_t> &variableIndices,
Equation &equation,
std::vector<int64_t> &equationIndices) const;

/// }
/// @name Debug functions
/// {
Expand Down Expand Up @@ -265,17 +248,6 @@ class IDAInstance {
// The iteration ranges of the vectorized equations.
std::vector<MultidimensionalRange> equationRanges;

// The array variables written by the equations.
// The i-th position contains the information about the variable written
// by the i-th equation: the first element is the index of the IDA
// variable, while the second represents the ranges of the scalar
// variable.
std::vector<std::pair<Variable, AccessFunction>> writeAccesses;

// The order in which the equations must be processed when computing
// residuals and partial derivatives.
std::vector<Equation> equationsProcessingOrder;

// The residual functions associated with the equations.
// The i-th position contains the pointer to the residual function of the
// i-th equation.
Expand All @@ -300,6 +272,10 @@ class IDAInstance {
// The dimensions list of each array variable.
std::vector<VariableDimensions> variablesDimensions;

// The offset of each array equation inside the flattened equations
// vector.
std::vector<uint64_t> equationOffsets;

// Simulation times.
realtype startTime;
realtype endTime;
Expand Down Expand Up @@ -389,7 +365,7 @@ RUNTIME_FUNC_DECL(idaAddVariableAccess, void, PTR(void), uint64_t, uint64_t,
PTR(void))

RUNTIME_FUNC_DECL(idaAddEquation, uint64_t, PTR(void), PTR(int64_t), uint64_t,
uint64_t, PTR(void), PTR(void))
PTR(void))

RUNTIME_FUNC_DECL(idaSetResidual, void, PTR(void), uint64_t, PTR(void))

Expand Down
34 changes: 5 additions & 29 deletions include/marco/Runtime/Solvers/KINSOL/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class KINSOLInstance {

/// Add the information about an equation that is handled by KINSOL.
Equation addEquation(const int64_t *ranges, uint64_t rank,
Variable writtenVariable,
AccessFunction writeAccessFunction,
const char *stringRepresentation);

void addVariableAccess(Equation equation, Variable variableIndex,
Expand Down Expand Up @@ -117,10 +115,6 @@ class KINSOLInstance {

[[nodiscard]] uint64_t getEquationFlatSize(Equation equation) const;

[[nodiscard]] Variable getWrittenVariable(Equation equation) const;

[[nodiscard]] AccessFunction getWriteAccessFunction(Equation equation) const;

[[nodiscard]] uint64_t getVariableRank(Variable variable) const;

void
Expand Down Expand Up @@ -167,17 +161,6 @@ class KINSOLInstance {
bool kinsolSetUserData();
bool kinsolSetJacobianFunction();

/// }
/// @name Utility functions
/// {

/// Get the scalar equation writing to a certain scalar variable.
/// Warning: extremely slow, to be used only for debug purposes.
void getWritingEquation(Variable variable,
const std::vector<uint64_t> &variableIndices,
Equation &equation,
std::vector<int64_t> &equationIndices) const;

/// }
/// @name Debug functions
/// {
Expand Down Expand Up @@ -206,17 +189,6 @@ class KINSOLInstance {
// The iteration ranges of the vectorized equations.
std::vector<MultidimensionalRange> equationRanges;

// The array variables written by the equations.
// The i-th position contains the information about the variable written
// by the i-th equation: the first element is the index of the IDA
// variable, while the second represents the ranges of the scalar
// variable.
std::vector<std::pair<Variable, AccessFunction>> writeAccesses;

// The order in which the equations must be processed when computing
// residuals and partial derivatives.
std::vector<Equation> equationsProcessingOrder;

// The residual functions associated with the equations.
// The i-th position contains the pointer to the residual function of the
// i-th equation.
Expand All @@ -241,6 +213,10 @@ class KINSOLInstance {
// The dimensions list of each array variable.
std::vector<VariableDimensions> variablesDimensions;

// The offset of each array equation inside the flattened equations
// vector.
std::vector<uint64_t> equationOffsets;

// Variables vectors and values.
N_Vector variablesVector;

Expand Down Expand Up @@ -300,7 +276,7 @@ RUNTIME_FUNC_DECL(kinsolAddVariableAccess, void, PTR(void), uint64_t, uint64_t,
PTR(void))

RUNTIME_FUNC_DECL(kinsolAddEquation, uint64_t, PTR(void), PTR(int64_t),
uint64_t, uint64_t, PTR(void), PTR(void))
uint64_t, PTR(void))

RUNTIME_FUNC_DECL(kinsolSetResidual, void, PTR(void), uint64_t, PTR(void))

Expand Down
Loading