Skip to content
Snippets Groups Projects
Commit 98f08537 authored by podlesny's avatar podlesny
Browse files

.

parent 39b69a16
Branches
No related tags found
No related merge requests found
...@@ -185,7 +185,7 @@ int main(int argc, char *argv[]) { ...@@ -185,7 +185,7 @@ int main(int argc, char *argv[]) {
const auto & coarseContactNetwork = *contactNetwork.level(0); const auto & coarseContactNetwork = *contactNetwork.level(0);
const auto & fineContactNetwork = *contactNetwork.level(1); const auto & fineContactNetwork = *contactNetwork.level(1);
SupportPatchFactory<typename ContactNetwork::LevelContactNetwork> supportPatchFactory(coarseContactNetwork, fineContactNetwork); SupportPatchFactory<typename ContactNetwork::LevelContactNetwork> supportPatchFactory(coarseContactNetwork, fineContactNetwork);
size_t bodyID = 1; size_t bodyID = 2;
size_t patchDepth = 0; size_t patchDepth = 0;
std::cout << std::endl; std::cout << std::endl;
......
...@@ -293,6 +293,15 @@ class SupportPatchFactory ...@@ -293,6 +293,15 @@ class SupportPatchFactory
return false; return false;
}; };
auto isRPatchIntersection = [this](std::vector<std::set<size_t>>& dofs, const std::set<size_t>& patchVertices) {
for (auto& dof : dofs[0]) {
if (patchVertices.count(dof)) {
return true;
}
}
return false;
};
// construct coarse patch // construct coarse patch
std::vector<BodyElement> patchElements; std::vector<BodyElement> patchElements;
patchElements.emplace_back(seedElement); patchElements.emplace_back(seedElement);
...@@ -346,19 +355,28 @@ class SupportPatchFactory ...@@ -346,19 +355,28 @@ class SupportPatchFactory
if (coarseIntersectionMapper_.count(faceIdx)) { if (coarseIntersectionMapper_.count(faceIdx)) {
const auto& intersections = coarseIntersectionMapper_[faceIdx]; const auto& intersections = coarseIntersectionMapper_[faceIdx];
for (size_t i=0; i<intersections.size(); i++) { for (size_t i=0; i<intersections.size(); i++) {
const auto& intersection = intersections[i];
const auto& rIs = intersection.get(coarseContactNetwork_);
BodyElement neighbor; BodyElement neighbor;
neighbor.set(coarseContactNetwork_, intersections[i]); neighbor.set(coarseContactNetwork_, intersection);
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))
continue; continue;
std::cout << "elementID: " << coarseIndices_.elementIndex(neighbor.bodyID, neighbor.element) << std::endl; std::vector<std::set<size_t>> dofs;
remoteIntersectionDofs(coarseIndices_, rIs, bodyIdx, neighbor.bodyID, dofs, intersection.flip);
patchVertices.insert(neighborFaceDofs_[faceIdx].begin(), neighborFaceDofs_[faceIdx].end()); if (isRPatchIntersection(dofs, patchVertices)) {
patchVertices.insert(dofs[1].begin(), dofs[1].end());
patchElements.emplace_back(neighbor); patchElements.emplace_back(neighbor);
patchSeeds.push(neighbor); patchSeeds.push(neighbor);
} else {
newPatchVertices.insert(dofs[1].begin(), dofs[1].end());
nextSeeds.emplace_back(neighbor);
}
print(patchVertices, "patchVertices: "); print(patchVertices, "patchVertices: ");
} }
...@@ -418,6 +436,8 @@ class SupportPatchFactory ...@@ -418,6 +436,8 @@ class SupportPatchFactory
if (visited.count(elemIdx)) if (visited.count(elemIdx))
continue; continue;
std::cout << "coarse element: " << elemIdx << std::endl;
visited.insert(elemIdx); visited.insert(elemIdx);
const auto& grid = coarseContactNetwork_.body(coarseElem.bodyID)->gridView().grid(); const auto& grid = coarseContactNetwork_.body(coarseElem.bodyID)->gridView().grid();
...@@ -505,11 +525,7 @@ class SupportPatchFactory ...@@ -505,11 +525,7 @@ class SupportPatchFactory
const size_t outsideID = intersection.bodyID; const size_t outsideID = intersection.bodyID;
std::vector<std::set<size_t>> rIsDofs; std::vector<std::set<size_t>> rIsDofs;
if (intersection.flip) { remoteIntersectionDofs(fineIndices_, rIs, bodyID, outsideID, rIsDofs, intersection.flip);
remoteIntersectionDofs(fineIndices_, rIs, outsideID, bodyID, rIsDofs);
} else {
remoteIntersectionDofs(fineIndices_, rIs, bodyID, outsideID, rIsDofs);
}
if (rIs.neighbor()) { if (rIs.neighbor()) {
Element outsideFather; Element outsideFather;
...@@ -566,7 +582,9 @@ class SupportPatchFactory ...@@ -566,7 +582,9 @@ class SupportPatchFactory
} }
template <class RIntersection> template <class RIntersection>
void remoteIntersectionDofs(const NetworkIndexMapper& indices, const RIntersection& is, const size_t insideID, const size_t outsideID, std::vector<std::set<size_t>>& dofs) { void remoteIntersectionDofs(const NetworkIndexMapper& indices, const RIntersection& is, const size_t insideID, const size_t outsideID, std::vector<std::set<size_t>>& dofs, bool flip = false) {
assert(!flip || (flip && is.neighbor()));
dofs.resize(2); dofs.resize(2);
dofs[0].clear(); dofs[0].clear();
dofs[1].clear(); dofs[1].clear();
...@@ -574,6 +592,7 @@ class SupportPatchFactory ...@@ -574,6 +592,7 @@ class SupportPatchFactory
const auto& isGeo = is.geometry(); const auto& isGeo = is.geometry();
const auto& isRefElement = Dune::ReferenceElements<ctype, dim-1>::general(is.type()); const auto& isRefElement = Dune::ReferenceElements<ctype, dim-1>::general(is.type());
if (!flip) {
const auto& inside = is.inside(); const auto& inside = is.inside();
const auto& insideGeo = inside.geometry(); const auto& insideGeo = inside.geometry();
const auto& insideRefElement = Dune::ReferenceElements<ctype, dim>::general(inside.type()); const auto& insideRefElement = Dune::ReferenceElements<ctype, dim>::general(inside.type());
...@@ -604,6 +623,37 @@ class SupportPatchFactory ...@@ -604,6 +623,37 @@ class SupportPatchFactory
} }
} }
} }
} else {
const auto& inside = is.outside();
const auto& insideGeo = inside.geometry();
const auto& insideRefElement = Dune::ReferenceElements<ctype, dim>::general(inside.type());
const int dimElement = Dune::ReferenceElements<ctype, dim>::dimension;
for (int i=0; i<insideRefElement.size(is.indexInOutside(), 1, dimElement); i++) {
size_t idxInElement = insideRefElement.subEntity(is.indexInOutside(), 1, i, dimElement);
const auto& localCorner = isGeo.local(insideGeo.corner(idxInElement));
if (isRefElement.checkInside(localCorner)) {
dofs[0].insert(indices.vertexIndex(insideID, inside, idxInElement));
}
}
const auto& outside = is.inside();
const auto& outsideGeo = outside.geometry();
const auto& outsideRefElement = Dune::ReferenceElements<ctype, dim>::general(outside.type());
for (int i=0; i<outsideRefElement.size(is.indexInInside(), 1, dimElement); i++) {
size_t idxInElement = outsideRefElement.subEntity(is.indexInInside(), 1, i, dimElement);
const auto& localCorner = isGeo.local(outsideGeo.corner(idxInElement));
if (isRefElement.checkInside(localCorner)) {
dofs[1].insert(indices.vertexIndex(outsideID, outside, idxInElement));
}
}
}
} }
template <class Intersection> template <class Intersection>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment