Skip to content
Snippets Groups Projects
Commit 9c9e78c5 authored by lh1887's avatar lh1887
Browse files

Merge dune-functions LocalIndexSets into LocalViews

They were merged in upstream dune-functions and using the index sets is now deprecated.
parent 21c4b62b
No related branches found
No related tags found
1 merge request!28Merge dune-functions LocalIndexSets into LocalViews
Pipeline #
...@@ -35,9 +35,8 @@ public: ...@@ -35,9 +35,8 @@ public:
void assembleBulkEntries(VectorBackend&& vectorBackend, LocalAssembler&& localAssembler) const void assembleBulkEntries(VectorBackend&& vectorBackend, LocalAssembler&& localAssembler) const
{ {
auto trialLocalView = trialBasis_.localView(); auto trialLocalView = trialBasis_.localView();
auto trialLocalIndexSet = trialBasis_.localIndexSet();
using Field = std::decay_t<decltype(vectorBackend(trialLocalIndexSet.index(0)))>; using Field = std::decay_t<decltype(vectorBackend(trialLocalView.index(0)))>;
using LocalVector = Dune::BlockVector<Dune::FieldVector<Field,1>>; using LocalVector = Dune::BlockVector<Dune::FieldVector<Field,1>>;
auto localVector = LocalVector(trialLocalView.maxSize()); auto localVector = LocalVector(trialLocalView.maxSize());
...@@ -47,13 +46,12 @@ public: ...@@ -47,13 +46,12 @@ public:
{ {
const auto& element = it->inside(); const auto& element = it->inside();
trialLocalView.bind(element); trialLocalView.bind(element);
trialLocalIndexSet.bind(trialLocalView);
localAssembler(it, localVector, trialLocalView); localAssembler(it, localVector, trialLocalView);
for (size_t localRow=0; localRow<trialLocalIndexSet.size(); ++localRow) for (size_t localRow=0; localRow<trialLocalView.size(); ++localRow)
{ {
auto row = trialLocalIndexSet.index(localRow); auto row = trialLocalView.index(localRow);
vectorBackend(row) += localVector[localRow]; vectorBackend(row) += localVector[localRow];
} }
} }
......
...@@ -33,9 +33,8 @@ public: ...@@ -33,9 +33,8 @@ public:
void assembleBulkEntries(VectorBackend&& vectorBackend, LocalAssembler&& localAssembler) const void assembleBulkEntries(VectorBackend&& vectorBackend, LocalAssembler&& localAssembler) const
{ {
auto trialLocalView = trialBasis_.localView(); auto trialLocalView = trialBasis_.localView();
auto trialLocalIndexSet = trialBasis_.localIndexSet();
using Field = std::decay_t<decltype(vectorBackend(trialLocalIndexSet.index(0)))>; using Field = std::decay_t<decltype(vectorBackend(trialLocalView.index(0)))>;
using LocalVector = Dune::BlockVector<Dune::FieldVector<Field,1>>; using LocalVector = Dune::BlockVector<Dune::FieldVector<Field,1>>;
auto localVector = LocalVector(trialLocalView.maxSize()); auto localVector = LocalVector(trialLocalView.maxSize());
...@@ -43,14 +42,13 @@ public: ...@@ -43,14 +42,13 @@ public:
for (const auto& element : elements(trialBasis_.gridView())) for (const auto& element : elements(trialBasis_.gridView()))
{ {
trialLocalView.bind(element); trialLocalView.bind(element);
trialLocalIndexSet.bind(trialLocalView);
localAssembler(element, localVector, trialLocalView); localAssembler(element, localVector, trialLocalView);
// Add element stiffness matrix onto the global stiffness matrix // Add element stiffness matrix onto the global stiffness matrix
for (size_t localRow=0; localRow<trialLocalIndexSet.size(); ++localRow) for (size_t localRow=0; localRow<trialLocalView.size(); ++localRow)
{ {
auto row = trialLocalIndexSet.index(localRow); auto row = trialLocalView.index(localRow);
vectorBackend(row) += localVector[localRow]; vectorBackend(row) += localVector[localRow];
} }
} }
......
...@@ -38,26 +38,22 @@ public: ...@@ -38,26 +38,22 @@ public:
patternBuilder.resize(trialBasis_, ansatzBasis_); patternBuilder.resize(trialBasis_, ansatzBasis_);
auto trialLocalView = trialBasis_.localView(); auto trialLocalView = trialBasis_.localView();
auto trialLocalIndexSet = trialBasis_.localIndexSet();
auto ansatzLocalView = ansatzBasis_.localView(); auto ansatzLocalView = ansatzBasis_.localView();
auto ansatzLocalIndexSet = ansatzBasis_.localIndexSet();
for (const auto& element : elements(trialBasis_.gridView())) for (const auto& element : elements(trialBasis_.gridView()))
{ {
trialLocalView.bind(element); trialLocalView.bind(element);
trialLocalIndexSet.bind(trialLocalView);
ansatzLocalView.bind(element); ansatzLocalView.bind(element);
ansatzLocalIndexSet.bind(ansatzLocalView);
// Add element stiffness matrix onto the global stiffness matrix // Add element stiffness matrix onto the global stiffness matrix
for (size_t i=0; i<trialLocalIndexSet.size(); ++i) for (size_t i=0; i<trialLocalView.size(); ++i)
{ {
auto row = trialLocalIndexSet.index(i); auto row = trialLocalView.index(i);
for (size_t j=0; j<ansatzLocalIndexSet.size(); ++j) for (size_t j=0; j<ansatzLocalView.size(); ++j)
{ {
auto col = ansatzLocalIndexSet.index(j); auto col = ansatzLocalView.index(j);
patternBuilder.insertEntry(row,col); patternBuilder.insertEntry(row,col);
} }
} }
...@@ -72,30 +68,24 @@ public: ...@@ -72,30 +68,24 @@ public:
patternBuilder.resize(trialBasis_, ansatzBasis_); patternBuilder.resize(trialBasis_, ansatzBasis_);
auto insideTrialLocalView = trialBasis_.localView(); auto insideTrialLocalView = trialBasis_.localView();
auto insideTrialLocalIndexSet = trialBasis_.localIndexSet();
auto insideAnsatzLocalView = ansatzBasis_.localView(); auto insideAnsatzLocalView = ansatzBasis_.localView();
auto insideAnsatzLocalIndexSet = ansatzBasis_.localIndexSet();
auto outsideTrialLocalView = trialBasis_.localView(); auto outsideTrialLocalView = trialBasis_.localView();
auto outsideTrialLocalIndexSet = trialBasis_.localIndexSet();
auto outsideAnsatzLocalView = ansatzBasis_.localView(); auto outsideAnsatzLocalView = ansatzBasis_.localView();
auto outsideAnsatzLocalIndexSet = ansatzBasis_.localIndexSet();
for (const auto& element : elements(trialBasis_.gridView())) for (const auto& element : elements(trialBasis_.gridView()))
{ {
insideTrialLocalView.bind(element); insideTrialLocalView.bind(element);
insideTrialLocalIndexSet.bind(insideTrialLocalView);
insideAnsatzLocalView.bind(element); insideAnsatzLocalView.bind(element);
insideAnsatzLocalIndexSet.bind(insideAnsatzLocalView);
/* Coupling on the same element */ /* Coupling on the same element */
for (size_t i = 0; i < insideTrialLocalIndexSet.size(); i++) { for (size_t i = 0; i < insideTrialLocalView.size(); i++) {
auto row = insideTrialLocalIndexSet.index(i); auto row = insideTrialLocalView.index(i);
for (size_t j = 0; j < insideAnsatzLocalIndexSet.size(); j++) { for (size_t j = 0; j < insideAnsatzLocalView.size(); j++) {
auto col = insideAnsatzLocalIndexSet.index(j); auto col = insideAnsatzLocalView.index(j);
patternBuilder.insertEntry(row,col); patternBuilder.insertEntry(row,col);
} }
} }
...@@ -110,18 +100,16 @@ public: ...@@ -110,18 +100,16 @@ public:
// Bind the outer parts to the outer element // Bind the outer parts to the outer element
outsideTrialLocalView.bind(outsideElement); outsideTrialLocalView.bind(outsideElement);
outsideTrialLocalIndexSet.bind(outsideTrialLocalView);
outsideAnsatzLocalView.bind(outsideElement); outsideAnsatzLocalView.bind(outsideElement);
outsideAnsatzLocalIndexSet.bind(outsideAnsatzLocalView);
// We assume that all basis functions of the inner element couple with all basis functions from the outer one // We assume that all basis functions of the inner element couple with all basis functions from the outer one
for (size_t i=0; i<insideTrialLocalIndexSet.size(); ++i) for (size_t i=0; i<insideTrialLocalView.size(); ++i)
{ {
auto row = insideTrialLocalIndexSet.index(i); auto row = insideTrialLocalView.index(i);
for (size_t j=0; j<outsideAnsatzLocalIndexSet.size(); ++j) for (size_t j=0; j<outsideAnsatzLocalView.size(); ++j)
{ {
auto col = outsideAnsatzLocalIndexSet.index(j); auto col = outsideAnsatzLocalView.index(j);
patternBuilder.insertEntry(row,col); patternBuilder.insertEntry(row,col);
} }
} }
...@@ -136,12 +124,10 @@ public: ...@@ -136,12 +124,10 @@ public:
void assembleBulkEntries(MatrixBackend&& matrixBackend, LocalAssembler&& localAssembler) const void assembleBulkEntries(MatrixBackend&& matrixBackend, LocalAssembler&& localAssembler) const
{ {
auto trialLocalView = trialBasis_.localView(); auto trialLocalView = trialBasis_.localView();
auto trialLocalIndexSet = trialBasis_.localIndexSet();
auto ansatzLocalView = ansatzBasis_.localView(); auto ansatzLocalView = ansatzBasis_.localView();
auto ansatzLocalIndexSet = ansatzBasis_.localIndexSet();
using Field = std::decay_t<decltype(matrixBackend(trialLocalIndexSet.index(0), ansatzLocalIndexSet.index(0)))>; using Field = std::decay_t<decltype(matrixBackend(trialLocalView.index(0), ansatzLocalView.index(0)))>;
using LocalMatrix = Dune::Matrix<Dune::FieldMatrix<Field,1,1>>; using LocalMatrix = Dune::Matrix<Dune::FieldMatrix<Field,1,1>>;
auto localMatrix = LocalMatrix(trialLocalView.maxSize(), ansatzLocalView.maxSize()); auto localMatrix = LocalMatrix(trialLocalView.maxSize(), ansatzLocalView.maxSize());
...@@ -149,20 +135,18 @@ public: ...@@ -149,20 +135,18 @@ public:
for (const auto& element : elements(trialBasis_.gridView())) for (const auto& element : elements(trialBasis_.gridView()))
{ {
trialLocalView.bind(element); trialLocalView.bind(element);
trialLocalIndexSet.bind(trialLocalView);
ansatzLocalView.bind(element); ansatzLocalView.bind(element);
ansatzLocalIndexSet.bind(ansatzLocalView);
localAssembler(element, localMatrix, trialLocalView, ansatzLocalView); localAssembler(element, localMatrix, trialLocalView, ansatzLocalView);
// Add element stiffness matrix onto the global stiffness matrix // Add element stiffness matrix onto the global stiffness matrix
for (size_t localRow=0; localRow<trialLocalIndexSet.size(); ++localRow) for (size_t localRow=0; localRow<trialLocalView.size(); ++localRow)
{ {
auto row = trialLocalIndexSet.index(localRow); auto row = trialLocalView.index(localRow);
for (size_t localCol=0; localCol<ansatzLocalIndexSet.size(); ++localCol) for (size_t localCol=0; localCol<ansatzLocalView.size(); ++localCol)
{ {
auto col = ansatzLocalIndexSet.index(localCol); auto col = ansatzLocalView.index(localCol);
matrixBackend(row,col) += localMatrix[localRow][localCol]; matrixBackend(row,col) += localMatrix[localRow][localCol];
} }
} }
...@@ -184,18 +168,14 @@ public: ...@@ -184,18 +168,14 @@ public:
Dune::MultipleCodimMultipleGeomTypeMapper<GridView> faceMapper(trialBasis_.gridView(), mcmgElementLayout()); Dune::MultipleCodimMultipleGeomTypeMapper<GridView> faceMapper(trialBasis_.gridView(), mcmgElementLayout());
auto insideTrialLocalView = trialBasis_.localView(); auto insideTrialLocalView = trialBasis_.localView();
auto insideTrialLocalIndexSet = trialBasis_.localIndexSet();
auto insideAnsatzLocalView = ansatzBasis_.localView(); auto insideAnsatzLocalView = ansatzBasis_.localView();
auto insideAnsatzLocalIndexSet = ansatzBasis_.localIndexSet();
auto outsideTrialLocalView = trialBasis_.localView(); auto outsideTrialLocalView = trialBasis_.localView();
auto outsideTrialLocalIndexSet = trialBasis_.localIndexSet();
auto outsideAnsatzLocalView = ansatzBasis_.localView(); auto outsideAnsatzLocalView = ansatzBasis_.localView();
auto outsideAnsatzLocalIndexSet = ansatzBasis_.localIndexSet();
using Field = std::decay_t<decltype(matrixBackend(insideTrialLocalIndexSet.index(0), insideAnsatzLocalIndexSet.index(0)))>; using Field = std::decay_t<decltype(matrixBackend(insideTrialLocalView.index(0), insideAnsatzLocalView.index(0)))>;
using LocalMatrix = Dune::Matrix<Dune::FieldMatrix<Field,1,1>>; using LocalMatrix = Dune::Matrix<Dune::FieldMatrix<Field,1,1>>;
using MatrixContainer = Dune::Matrix<LocalMatrix>; using MatrixContainer = Dune::Matrix<LocalMatrix>;
auto matrixContrainer = MatrixContainer(2,2); auto matrixContrainer = MatrixContainer(2,2);
...@@ -209,10 +189,8 @@ public: ...@@ -209,10 +189,8 @@ public:
for (const auto& element : elements(trialBasis_.gridView())) for (const auto& element : elements(trialBasis_.gridView()))
{ {
insideTrialLocalView.bind(element); insideTrialLocalView.bind(element);
insideTrialLocalIndexSet.bind(insideTrialLocalView);
insideAnsatzLocalView.bind(element); insideAnsatzLocalView.bind(element);
insideAnsatzLocalIndexSet.bind(insideAnsatzLocalView);
for (const auto& is : intersections(trialBasis_.gridView(), element)) for (const auto& is : intersections(trialBasis_.gridView(), element))
{ {
...@@ -223,9 +201,9 @@ public: ...@@ -223,9 +201,9 @@ public:
auto& localMatrix = matrixContrainer[0][0]; auto& localMatrix = matrixContrainer[0][0];
localBoundaryAssembler(is, localMatrix, insideTrialLocalView, insideAnsatzLocalView); localBoundaryAssembler(is, localMatrix, insideTrialLocalView, insideAnsatzLocalView);
for (size_t i=0; i< insideTrialLocalIndexSet.size(); i++) { for (size_t i=0; i< insideTrialLocalView.size(); i++) {
for (size_t j=0; j< insideAnsatzLocalIndexSet.size(); j++) for (size_t j=0; j< insideAnsatzLocalView.size(); j++)
matrixBackend(insideTrialLocalIndexSet.index(i), insideAnsatzLocalIndexSet.index(j))+=localMatrix[i][j]; matrixBackend(insideTrialLocalView.index(i), insideAnsatzLocalView.index(j))+=localMatrix[i][j];
} }
} }
else if (is.neighbor()) else if (is.neighbor())
...@@ -240,43 +218,41 @@ public: ...@@ -240,43 +218,41 @@ public:
// Bind the outer parts to the outer element // Bind the outer parts to the outer element
outsideTrialLocalView.bind(outsideElement); outsideTrialLocalView.bind(outsideElement);
outsideTrialLocalIndexSet.bind(outsideTrialLocalView);
outsideAnsatzLocalView.bind(outsideElement); outsideAnsatzLocalView.bind(outsideElement);
outsideAnsatzLocalIndexSet.bind(outsideAnsatzLocalView);
localAssembler(is, matrixContrainer, insideTrialLocalView, insideAnsatzLocalView, outsideTrialLocalView, outsideAnsatzLocalView); localAssembler(is, matrixContrainer, insideTrialLocalView, insideAnsatzLocalView, outsideTrialLocalView, outsideAnsatzLocalView);
for (size_t i=0; i < insideTrialLocalIndexSet.size(); i++) for (size_t i=0; i < insideTrialLocalView.size(); i++)
{ {
auto row = insideTrialLocalIndexSet.index(i); auto row = insideTrialLocalView.index(i);
// inside x inside // inside x inside
for (size_t j=0; j < insideTrialLocalIndexSet.size(); j++) for (size_t j=0; j < insideTrialLocalView.size(); j++)
{ {
auto col = insideTrialLocalIndexSet.index(j); auto col = insideTrialLocalView.index(j);
matrixBackend(row, col) += matrixContrainer[0][0][i][j]; matrixBackend(row, col) += matrixContrainer[0][0][i][j];
} }
// inside x outside // inside x outside
for (size_t j=0; j < outsideAnsatzLocalIndexSet.size(); j++) for (size_t j=0; j < outsideAnsatzLocalView.size(); j++)
{ {
auto col = outsideAnsatzLocalIndexSet.index(j); auto col = outsideAnsatzLocalView.index(j);
matrixBackend(row, col) += matrixContrainer[0][1][i][j]; matrixBackend(row, col) += matrixContrainer[0][1][i][j];
} }
} }
for (size_t i=0; i < outsideTrialLocalIndexSet.size(); i++) for (size_t i=0; i < outsideTrialLocalView.size(); i++)
{ {
auto row = outsideTrialLocalIndexSet.index(i); auto row = outsideTrialLocalView.index(i);
// outside x inside // outside x inside
for (size_t j=0; j < insideAnsatzLocalIndexSet.size(); j++) for (size_t j=0; j < insideAnsatzLocalView.size(); j++)
{ {
auto col = insideAnsatzLocalIndexSet.index(j); auto col = insideAnsatzLocalView.index(j);
matrixBackend(row, col) += matrixContrainer[1][0][i][j]; matrixBackend(row, col) += matrixContrainer[1][0][i][j];
} }
// outside x outside // outside x outside
for (size_t j=0; j < outsideAnsatzLocalIndexSet.size(); j++) for (size_t j=0; j < outsideAnsatzLocalView.size(); j++)
{ {
auto col = outsideAnsatzLocalIndexSet.index(j); auto col = outsideAnsatzLocalView.index(j);
matrixBackend(row, col) += matrixContrainer[1][1][i][j]; matrixBackend(row, col) += matrixContrainer[1][1][i][j];
} }
} }
......
...@@ -71,12 +71,8 @@ public: ...@@ -71,12 +71,8 @@ public:
*/ */
int index(const Element& element, const int i) const int index(const Element& element, const int i) const
{ {
auto localIndexSet = dfBasis_.localIndexSet();
localView_.bind(element); localView_.bind(element);
localIndexSet.bind(localView_); return localView_.index(i)[0];
return localIndexSet.index(i)[0];
} }
protected: protected:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment