Skip to content
Snippets Groups Projects
Commit 2b787c07 authored by podlesny's avatar podlesny
Browse files

supportpatchfactory almost working, next try to implement separate queues for each body

parent 98f08537
No related branches found
No related tags found
No related merge requests found
...@@ -85,6 +85,7 @@ template <class Grid> GridsConstructor<Grid>::GridsConstructor(const std::vector ...@@ -85,6 +85,7 @@ template <class Grid> GridsConstructor<Grid>::GridsConstructor(const std::vector
} }
grids[idx] = std::shared_ptr<Grid>(gridFactories[idx].createGrid()); grids[idx] = std::shared_ptr<Grid>(gridFactories[idx].createGrid());
grids[idx]->setRefinementType(Grid::RefinementType::COPY);
} }
} }
......
...@@ -182,11 +182,18 @@ int main(int argc, char *argv[]) { ...@@ -182,11 +182,18 @@ int main(int argc, char *argv[]) {
// ---------------------------- // ----------------------------
contactNetwork.assemble(); contactNetwork.assemble();
const auto & coarseContactNetwork = *contactNetwork.level(0); /* std::vector<Vector> def(bodyCount);
const auto & fineContactNetwork = *contactNetwork.level(1); for (size_t i=0; i<bodyCount; i++) {
def[i].resize(contactNetwork.body(i)->nVertices());
def[i] = 1;
}
contactNetwork.setDeformation(def);*/
const auto & coarseContactNetwork = *contactNetwork.level(3);
const auto & fineContactNetwork = *contactNetwork.level(4);
SupportPatchFactory<typename ContactNetwork::LevelContactNetwork> supportPatchFactory(coarseContactNetwork, fineContactNetwork); SupportPatchFactory<typename ContactNetwork::LevelContactNetwork> supportPatchFactory(coarseContactNetwork, fineContactNetwork);
size_t bodyID = 2; size_t bodyID = 2;
size_t patchDepth = 0; size_t patchDepth = 3;
std::cout << std::endl; std::cout << std::endl;
......
...@@ -315,18 +315,23 @@ class SupportPatchFactory ...@@ -315,18 +315,23 @@ class SupportPatchFactory
std::queue<BodyElement> patchSeeds; std::queue<BodyElement> patchSeeds;
patchSeeds.push(seedElement); patchSeeds.push(seedElement);
std::set<size_t> visitedBodies;
for (size_t depth=0; depth<=patchDepth; depth++) { for (size_t depth=0; depth<=patchDepth; depth++) {
std::vector<BodyElement> nextSeeds; std::vector<BodyElement> nextSeeds;
std::set<size_t> newPatchVertices; std::set<size_t> newPatchVertices;
while (!patchSeeds.empty()) { while (!patchSeeds.empty()) {
const auto& patchSeed = patchSeeds.front(); const auto& patchSeed = patchSeeds.front();
patchSeeds.pop();
size_t elemIdx = coarseIndices_.elementIndex(patchSeed.bodyID, patchSeed.element); size_t elemIdx = coarseIndices_.elementIndex(patchSeed.bodyID, patchSeed.element);
if (visitedElements.count(elemIdx)) if (visitedElements.count(elemIdx)) {
patchSeeds.pop();
continue; continue;
}
visitedBodies.insert(patchSeed.bodyID);
visitedElements.insert(elemIdx); visitedElements.insert(elemIdx);
...@@ -363,7 +368,7 @@ class SupportPatchFactory ...@@ -363,7 +368,7 @@ class SupportPatchFactory
size_t neighborIdx = coarseIndices_.elementIndex(neighbor.bodyID, neighbor.element); size_t neighborIdx = coarseIndices_.elementIndex(neighbor.bodyID, neighbor.element);
if (visitedElements.count(neighborIdx)) if (visitedElements.count(neighborIdx) || visitedBodies.count(neighbor.bodyID))
continue; continue;
std::vector<std::set<size_t>> dofs; std::vector<std::set<size_t>> dofs;
...@@ -404,7 +409,7 @@ class SupportPatchFactory ...@@ -404,7 +409,7 @@ class SupportPatchFactory
size_t neighborIdx = coarseIndices_.elementIndex(neighbor.bodyID, neighbor.element); size_t neighborIdx = coarseIndices_.elementIndex(neighbor.bodyID, neighbor.element);
if (visitedElements.count(neighborIdx)) if (visitedElements.count(neighborIdx) || visitedBodies.count(neighbor.bodyID))
continue; continue;
newPatchVertices.insert(neighborFaceDofs_[faceIdx].begin(), neighborFaceDofs_[faceIdx].end()); newPatchVertices.insert(neighborFaceDofs_[faceIdx].begin(), neighborFaceDofs_[faceIdx].end());
...@@ -414,6 +419,8 @@ class SupportPatchFactory ...@@ -414,6 +419,8 @@ class SupportPatchFactory
} }
} }
} }
patchSeeds.pop();
} }
for (size_t i=0; i<nextSeeds.size(); i++) { for (size_t i=0; i<nextSeeds.size(); i++) {
...@@ -499,7 +506,7 @@ class SupportPatchFactory ...@@ -499,7 +506,7 @@ class SupportPatchFactory
const auto& gridView = fineContactNetwork_.body(coarseElem.bodyID)->gridView(); const auto& gridView = fineContactNetwork_.body(coarseElem.bodyID)->gridView();
const size_t bodyID = coarseElem.bodyID; const size_t bodyID = coarseElem.bodyID;
const auto coarseLevel = coarseElem.element.level(); const auto coarseLevel = coarseContactNetwork_.body(coarseElem.bodyID)->level();
// search for parts of the global and inner boundary // search for parts of the global and inner boundary
for (const auto& is : intersections(gridView, fineElem)) { for (const auto& is : intersections(gridView, fineElem)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment