diff --git a/Project.toml b/Project.toml index 70c491d..039636e 100644 --- a/Project.toml +++ b/Project.toml @@ -9,17 +9,22 @@ BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" DrWatson = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e" -GridapDistributed = "f9701e48-63b3-45aa-9a63-9bc6c271f355" GridapGmsh = "3025c34a-b394-11e9-2a55-3fee550c04c8" -GridapPETSc = "bcdc36c2-0c3e-11ea-095a-c9dadae499f1" GridapSolvers = "6d3209ee-5e3c-4db7-a716-942eb12ed534" IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -PartitionedArrays = "5a9dfac6-5c52-46f7-8278-5e2210713be9" Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7" Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" + +[weakdeps] +GridapDistributed = "f9701e48-63b3-45aa-9a63-9bc6c271f355" +GridapPETSc = "bcdc36c2-0c3e-11ea-095a-c9dadae499f1" +PartitionedArrays = "5a9dfac6-5c52-46f7-8278-5e2210713be9" + +[extensions] +HyperFEMDistributed = ["GridapDistributed", "GridapPETSc", "PartitionedArrays"] diff --git a/ext/ComputationalModels/ComputationalModels.jl b/ext/ComputationalModels/ComputationalModels.jl new file mode 100644 index 0000000..de08eb9 --- /dev/null +++ b/ext/ComputationalModels/ComputationalModels.jl @@ -0,0 +1,11 @@ +module ComputationalModels + +using HyperFEM +using Gridap, GridapDistributed, GridapPETSc +using PartitionedArrays +using PartitionedArrays: getany + +include("FESpaces.jl") +include("GridapExtras.jl") + +end diff --git a/ext/ComputationalModels/FESpaces.jl b/ext/ComputationalModels/FESpaces.jl new file mode 100644 index 0000000..c260bfd --- /dev/null +++ b/ext/ComputationalModels/FESpaces.jl @@ -0,0 +1,6 @@ + +import HyperFEM.instantiate_caches + +function instantiate_caches(x, nls::PETScNonlinearSolver, op::NonlinearOperator) + return GridapPETSc._setup_cache(x, nls, op) +end diff --git a/ext/ComputationalModels/GridapExtras.jl b/ext/ComputationalModels/GridapExtras.jl new file mode 100644 index 0000000..5282d8c --- /dev/null +++ b/ext/ComputationalModels/GridapExtras.jl @@ -0,0 +1,14 @@ + +import HyperFEM.ComputationalModels.get_local_matrix_type +import HyperFEM.ComputationalModels.get_local_vector_type +import HyperFEM.ComputationalModels.get_local_assembly_strategy + +function get_local_matrix_type(a::GridapDistributed.DistributedSparseMatrixAssembler) + return getany(map(get_matrix_type,a.assems)) +end +function get_local_vector_type(a::GridapDistributed.DistributedSparseMatrixAssembler) + return getany(map(get_vector_type,a.assems)) +end +function get_local_assembly_strategy(a::GridapDistributed.DistributedSparseMatrixAssembler) + return get_assembly_strategy(a) +end diff --git a/ext/HyperFEMDistributed.jl b/ext/HyperFEMDistributed.jl new file mode 100644 index 0000000..570fc08 --- /dev/null +++ b/ext/HyperFEMDistributed.jl @@ -0,0 +1,7 @@ +module HyperFEMDistributed + +using HyperFEM + +include("ComputationalModels/ComputationalModels.jl") + +end \ No newline at end of file diff --git a/src/ComputationalModels/ComputationalModels.jl b/src/ComputationalModels/ComputationalModels.jl index 3f850de..c0dff03 100644 --- a/src/ComputationalModels/ComputationalModels.jl +++ b/src/ComputationalModels/ComputationalModels.jl @@ -11,18 +11,6 @@ using Gridap.FESpaces: get_assembly_strategy import Gridap: solve! using BlockArrays -using GridapPETSc, GridapPETSc.PETSC -using GridapPETSc: PetscScalar, PetscInt, PETSC - -using GridapDistributed -using GridapDistributed: DistributedDiscreteModel, DistributedTriangulation, - DistributedFESpace, DistributedDomainContribution, to_parray_of_arrays, - allocate_in_domain, DistributedCellField, DistributedMultiFieldCellField, - DistributedMultiFieldFEBasis, BlockPMatrix, BlockPVector, change_ghost - -using PartitionedArrays -using PartitionedArrays: getany - using GridapSolvers using GridapSolvers.LinearSolvers, GridapSolvers.NonlinearSolvers, GridapSolvers.BlockSolvers using GridapSolvers.SolverInterfaces: SolverVerboseLevel, SOLVER_VERBOSE_NONE, SOLVER_VERBOSE_LOW, SOLVER_VERBOSE_HIGH diff --git a/src/ComputationalModels/FESpaces.jl b/src/ComputationalModels/FESpaces.jl index db03aea..a36f8f2 100644 --- a/src/ComputationalModels/FESpaces.jl +++ b/src/ComputationalModels/FESpaces.jl @@ -144,14 +144,3 @@ function instantiate_caches(x, nls::Newton_RaphsonSolver, op::NonlinearOperator) ns = numerical_setup(ss, A, x) return Newton_RaphsonCache(A, b, dx, ns) end - - -function instantiate_caches(x, nls::PETScNonlinearSolver, op::NonlinearOperator) - return GridapPETSc._setup_cache(x, nls, op) -end - - - - - - diff --git a/src/ComputationalModels/GridapExtras.jl b/src/ComputationalModels/GridapExtras.jl index ff9394d..7c9cc86 100644 --- a/src/ComputationalModels/GridapExtras.jl +++ b/src/ComputationalModels/GridapExtras.jl @@ -16,16 +16,6 @@ get_local_matrix_type(a::Assembler) = get_matrix_type(a) get_local_vector_type(a::Assembler) = get_vector_type(a) get_local_assembly_strategy(a::Assembler) = get_assembly_strategy(a) -function get_local_matrix_type(a::GridapDistributed.DistributedSparseMatrixAssembler) - return getany(map(get_matrix_type,a.assems)) -end -function get_local_vector_type(a::GridapDistributed.DistributedSparseMatrixAssembler) - return getany(map(get_vector_type,a.assems)) -end -function get_local_assembly_strategy(a::GridapDistributed.DistributedSparseMatrixAssembler) - return get_assembly_strategy(a) -end - function get_local_matrix_type(a::MultiField.BlockSparseMatrixAssembler) return get_local_matrix_type(first(a.block_assemblers)) end