refactor: extract math solver boundary
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/Core/Types.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
struct SparsePatternEntry {
|
||||
EquationId row = 0;
|
||||
EquationId col = 0;
|
||||
};
|
||||
|
||||
struct SparsePattern {
|
||||
EquationId equation_count = 0;
|
||||
std::vector<SparsePatternEntry> entries;
|
||||
|
||||
SparseIndex nonzeroCount() const {
|
||||
return static_cast<SparseIndex>(entries.size());
|
||||
}
|
||||
|
||||
bool contains(EquationId row, EquationId col) const {
|
||||
return std::any_of(entries.begin(), entries.end(), [&](const SparsePatternEntry& entry) {
|
||||
return entry.row == row && entry.col == col;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
Reference in New Issue
Block a user