@@ -590,8 +590,7 @@ function compute_closest_point_projections(model::OctreeDistributedDiscreteModel
590590 fgrid = vec (map (i-> xmin+ Point ((Tuple (i).- 1 ). * fsizes),
591591 CartesianIndices ((fcells... ,))))
592592 fvals = φ .(fgrid)
593- @show length (fvals)
594-
593+
595594 # Coordinates of free DoFs on each local partition
596595 coords = interpolate_everywhere (identity,V)
597596 coords_vals = get_free_dof_values (coords)
@@ -604,14 +603,15 @@ function compute_closest_point_projections(model::OctreeDistributedDiscreteModel
604603 FEFunction (V,PVector (cpps,partition (V. gids)))
605604end
606605
607- function compute_closest_point_projections (model:: OctreeDistributedDiscreteModel ,
608- V:: DistributedFESpace ,
609- φ:: DistributedAlgoimCallLevelSetFunction ,
610- order:: Int ,
611- max_refinement_level:: Int ;
612- cppdegree:: Int = 2 ,
613- trim:: Bool = false ,
614- limitstol:: Float64 = 1.0e-8 )
606+ function compute_closest_point_projections (
607+ model:: OctreeDistributedDiscreteModel ,
608+ V:: DistributedFESpace ,
609+ φ:: DistributedAlgoimCallLevelSetFunction ,
610+ order:: Int ,
611+ max_refinement_level:: Int ;
612+ cppdegree:: Int = 2 ,
613+ trim:: Bool = false ,
614+ limitstol:: Float64 = 1.0e-8 )
615615
616616 # Uniform partition at the maximum refinement level
617617 coarse_desc = get_cartesian_descriptor (model. coarse_model)
@@ -624,11 +624,10 @@ function compute_closest_point_projections(model::OctreeDistributedDiscreteModel
624624 # The level set values at the maximum refinement level
625625 fsizes =
626626 coarse_desc. sizes ./ ( Int32 (2 ^ max_refinement_level) * Int32 (order) )
627- fcells = fine_partition.+ 1
627+ fcells = fine_partition .+ 1
628628 fgrid = vec (map (i-> xmin+ Point ((Tuple (i).- 1 ). * fsizes),
629629 CartesianIndices ((fcells... ,))))
630-
631- # This is a hack to evaluate the LS function on 2D
630+ # A hack follows to evaluate the LS function on 2D
632631 # OctreeDistributedDiscreteModels, as the current
633632 # implementation of Interpolable is not using the
634633 # NonConformingGridapTopology, so the list of cells
@@ -1127,6 +1126,34 @@ function compute_distance_fe_function(
11271126 FEFunction (fespace_scalar_type,dists)
11281127end
11291128
1129+ function compute_distance_fe_function (
1130+ bgmodel:: OctreeDistributedDiscreteModel ,
1131+ fespace_scalar_type:: DistributedFESpace ,
1132+ fespace_vector_type:: DistributedFESpace ,
1133+ φ:: DistributedAlgoimCallLevelSetFunction ,
1134+ order:: Int ,
1135+ max_refinement_level:: Int ;
1136+ cppdegree:: Int = 2 )
1137+
1138+ cps = compute_closest_point_projections (
1139+ bgmodel,fespace_vector_type,φ,order,
1140+ max_refinement_level,cppdegree= cppdegree)
1141+ cps_vals = get_free_dof_values (cps)
1142+
1143+ coords = interpolate_everywhere (identity,fespace_vector_type)
1144+ coords_vals = get_free_dof_values (coords)
1145+
1146+ _dists = map (local_views (fespace_scalar_type),
1147+ local_views (cps_vals),
1148+ local_views (coords_vals),
1149+ local_views (φ)) do fs,cp,cos,φl
1150+ _compute_signed_distance (φl,cp,cos,num_free_dofs (fs),
1151+ num_dims (bgmodel. coarse_model))
1152+ end
1153+ dists = PVector (_dists,partition (fespace_scalar_type. gids))
1154+ FEFunction (fespace_scalar_type,dists)
1155+ end
1156+
11301157function compute_distance_fe_function (
11311158 fespace_scalar_type:: FESpace ,
11321159 fespace_vector_type:: FESpace ,
0 commit comments