-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from PetrKryslUCSD/development
Development
- Loading branch information
Showing
12 changed files
with
163 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "FinEtoolsDDMethods" | ||
uuid = "093fdad3-4fce-4574-aa49-c2a24de4f00d" | ||
authors = ["Petr Krysl <[email protected]>"] | ||
version = "0.3.2" | ||
version = "0.4.0" | ||
|
||
[deps] | ||
CoNCMOR = "3a989f29-cff0-4f1c-87be-5dcdd41bd240" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
""" | ||
CompatibilityModule | ||
Module for compatibility with the old version that went into the review. | ||
""" | ||
module CompatibilityModule | ||
|
||
__precompile__(true) | ||
|
||
using FinEtools | ||
using CoNCMOR | ||
using SparseArrays | ||
using Krylov | ||
using Metis | ||
using LinearOperators | ||
using SparseArrays | ||
using LinearAlgebra | ||
import Base: size, eltype | ||
import LinearAlgebra: mul!, eigen | ||
using Statistics: mean | ||
using ..FENodeToPartitionMapModule: FENodeToPartitionMap | ||
using ShellStructureTopo | ||
using DataDrop | ||
|
||
function _make_overlapping_partition(fes, n2e, overlap, element_1st_partitioning, i) | ||
enl = findall(x -> x == i, element_1st_partitioning) | ||
touched = fill(false, count(fes)) | ||
touched[enl] .= true | ||
for ov in 1:overlap | ||
sfes = subset(fes, enl) | ||
bsfes = meshboundary(sfes) | ||
addenl = Int[] | ||
for e in eachindex(bsfes) | ||
for n in bsfes.conn[e] | ||
for ne in n2e.map[n] | ||
if !touched[ne] | ||
touched[ne] = true | ||
push!(addenl, ne) | ||
end | ||
end | ||
end | ||
end | ||
enl = cat(enl, addenl; dims=1) | ||
end | ||
# vtkexportmesh("i=$i" * "-enl" * "-final" * ".vtk", fens, subset(fes, enl)) | ||
return connectednodes(subset(fes, enl)) | ||
end | ||
|
||
""" | ||
fine_grid_node_lists(fens, fes, npartitions, overlap) | ||
Make node lists for all partitions of the fine grid. | ||
The fine grid is partitioned into `npartitions` using the Metis library. The | ||
partitions are extended by the given overlap. Then for each extended partition | ||
of elements, the list of nodes is collected. | ||
List of these node-lists is returned. | ||
""" | ||
function fine_grid_node_lists(fens, fes, npartitions, overlap) | ||
femm = FEMMBase(IntegDomain(fes, PointRule())) | ||
C = dualconnectionmatrix(femm, fens, nodesperelem(boundaryfe(fes))) | ||
g = Metis.graph(C; check_hermitian=true) | ||
element_1st_partitioning = Metis.partition(g, npartitions; alg=:KWAY) | ||
npartitions = maximum(element_1st_partitioning) | ||
n2e = FENodeToFEMap(fes, count(fens)) | ||
nodelists = [] | ||
for i in 1:npartitions | ||
push!(nodelists, _make_overlapping_partition(fes, n2e, overlap, element_1st_partitioning, i)) | ||
end | ||
nodelists | ||
end | ||
|
||
end # module CompatibilityModule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.