Skip to content

Commit 69710b9

Browse files
committed
change key type to support bigger meshes
1 parent a70f565 commit 69710b9

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Sofa/Component/LinearSystem/src/sofa/component/linearsystem/ConstantSparsityPatternSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class SOFA_COMPONENT_LINEARSYSTEM_API ConstantSparsityPatternSystem : public Mat
6969
void resizeSystem(sofa::Size n) override;
7070
void clearSystem() override;
7171

72-
using ConstantCRSMapping = std::unordered_map<sofa::SignedIndex, std::size_t>;
72+
using ConstantCRSMapping = std::unordered_map<std::int64_t, std::size_t>;
7373

7474
bool isConstantSparsityPatternUsedYet() const;
7575

Sofa/Component/LinearSystem/src/sofa/component/linearsystem/ConstantSparsityPatternSystem.inl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void ConstantSparsityPatternSystem<TMatrix, TVector>::replaceLocalMatrixMapped(c
132132
mat->compressedInsertionOrderList.reserve(insertionOrderList.size());
133133
for (const auto& [row, col] : insertionOrderList)
134134
{
135-
mat->compressedInsertionOrderList.push_back(mapping.at(row + col * sharedMatrix->rows()));
135+
mat->compressedInsertionOrderList.push_back(mapping.at(static_cast<std::int64_t>(row) + static_cast<std::int64_t>(col) * sharedMatrix->rows()));
136136
}
137137
}
138138
else
@@ -209,7 +209,7 @@ void ConstantSparsityPatternSystem<TMatrix, TVector>::replaceLocalMatrixNonMappe
209209
// row and col are in global coordinates but the local coordinates will be checked
210210
pairInsertionOrderList.push_back({row - posInGlobalMatrix[0], col - posInGlobalMatrix[1]});
211211

212-
const auto flatIndex = row + col * this->getSystemMatrix()->rows();
212+
const auto flatIndex = static_cast<std::int64_t>(row) + static_cast<std::int64_t>(col) * this->getSystemMatrix()->rows();
213213
const auto it = m_constantCRSMapping->find(flatIndex);
214214
if (it != m_constantCRSMapping->end())
215215
{
@@ -327,7 +327,7 @@ void ConstantSparsityPatternSystem<TMatrix, TVector>::buildHashTable(linearalgeb
327327
for(auto xj = rowRange.begin() ; xj < rowRange.end() ; ++xj ) // for each non-null block
328328
{
329329
const auto col = M.colsIndex[xj];
330-
mapping.emplace(row + col * M.rows(), xj);
330+
mapping.emplace(static_cast<std::int64_t>(row) + static_cast<std::int64_t>(col) * M.rows(), xj);
331331
}
332332
}
333333
}

0 commit comments

Comments
 (0)