Skip to content

Commit

Permalink
Added ParallelT8codeMesh to constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Markert committed Dec 19, 2023
1 parent 0026a72 commit e7175cf
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/meshes/t8code_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ to manage trees and mesh refinement.
"""
mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <:
AbstractMesh{NDIMS}
cmesh :: Ptr{t8_cmesh} # cpointer to coarse mesh
scheme :: Ptr{t8_eclass_scheme} # cpointer to element scheme
forest :: Ptr{t8_forest} # cpointer to forest
is_parallel :: IsParallel

Expand All @@ -27,14 +25,16 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <:
nmortars :: Int
nboundaries :: Int

function T8codeMesh{NDIMS}(cmesh, scheme, forest, tree_node_coordinates, nodes,
nmpiinterfaces :: Int
nmpimortars :: Int

function T8codeMesh{NDIMS}(forest, tree_node_coordinates, nodes,
boundary_names,
current_filename) where {NDIMS}
is_parallel = False()

mesh = new{NDIMS, Float64, typeof(is_parallel), NDIMS + 2, length(nodes)}(cmesh,
scheme,
forest,
is_parallel = mpi_isparallel()

mesh = new{NDIMS, Float64, typeof(is_parallel), NDIMS + 2, length(nodes)}(forest,
is_parallel)

mesh.nodes = nodes
Expand Down Expand Up @@ -74,7 +74,9 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <:
end

const SerialT8codeMesh{NDIMS} = T8codeMesh{NDIMS, <:Real, <:False}
const ParallelT8codeMesh{NDIMS} = T8codeMesh{NDIMS, <:Real, <:True}
@inline mpi_parallel(mesh::SerialT8codeMesh) = False()
@inline mpi_parallel(mesh::ParallelT8codeMesh) = True()

@inline Base.ndims(::T8codeMesh{NDIMS}) where {NDIMS} = NDIMS
@inline Base.real(::T8codeMesh{NDIMS, RealT}) where {NDIMS, RealT} = RealT
Expand Down Expand Up @@ -260,7 +262,7 @@ function T8codeMesh(trees_per_dimension; polydeg,
end
end

return T8codeMesh{NDIMS}(cmesh, scheme, forest, tree_node_coordinates, nodes,
return T8codeMesh{NDIMS}(forest, tree_node_coordinates, nodes,
boundary_names, "")
end

Expand Down Expand Up @@ -367,7 +369,7 @@ function T8codeMesh{NDIMS}(cmesh::Ptr{t8_cmesh};
# There's no simple and generic way to distinguish boundaries. Name all of them :all.
boundary_names = fill(:all, 2 * NDIMS, num_local_trees)

return T8codeMesh{NDIMS}(cmesh, scheme, forest, tree_node_coordinates, nodes,
return T8codeMesh{NDIMS}(forest, tree_node_coordinates, nodes,
boundary_names, "")
end

Expand Down

0 comments on commit e7175cf

Please sign in to comment.