diff --git a/NEWS.md b/NEWS.md index c79e552..e8503e2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,43 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [Unreleased] -### Added - -- New overloads for the `TrialFESpace` constructor where the data to be imposed is passed as a `DistributedCellField`. Since PR[#183](https://github.com/gridap/GridapDistributed.jl/pull/183). -- Added missing `FESpace` constructors for distributed triangulations specialized for the RT FEs case. Since PR[#188](https://github.com/gridap/GridapDistributed.jl/pull/188) - -## [0.4.10] - 2025-09-29 - -### Added - -- Added support for multiple ghost layers on cartesian models. Since PR[#182](https://github.com/gridap/GridapDistributed.jl/pull/182). -- Added new way of doing AD for MultiField, where partials are computed separately for each field then merged together. Since PR[#176](https://github.com/gridap/GridapDistributed.jl/pull/176). - -### Fixed - -- Fixed issue [#177](https://github.com/gridap/GridapDistributed.jl/issues/177) and [#170](https://github.com/gridap/GridapDistributed.jl/issues/170). Since PR[#180](https://github.com/gridap/GridapDistributed.jl/pull/180). -- Fixed issue where calling `Boundary(with_ghost, dmodel)` would return the local processor boundaries (which include the faces at the interface between processors) instead of returning the local part of the global boundary. Since PR[#180](https://github.com/gridap/GridapDistributed.jl/pull/180). - -## [0.4.9] - 2025-08-08 - -### Added - -- Added a new framework for redistributing dofs, which is more efficient and flexible than the previous one. Since PR[#179](https://github.com/gridap/GridapDistributed.jl/pull/179). - -### Fixed - -- Fixed bug when redistributing periodic cartesian models. Since PR[#179](https://github.com/gridap/GridapDistributed.jl/pull/179). - -## [0.4.8] - 2025-06-11 - -### Added +### Fixed -- Added support for Gridap v0.19, with distributed counterparts for the new feaures introduced. This includes support for polytopal meshes, polytopal methods and patch assembly. Since PR[#175](https://github.com/gridap/GridapDistributed.jl/pull/175). -- Added `MacroDiscreteModel`, which gives a global numbering and classification of the interfaces between processors. Since PR[#175](https://github.com/gridap/GridapDistributed.jl/pull/175). +- Added support to create pvd files when the triangulation is not there on all processes. To achive this, a new method for the createpvd function is added. -## [0.4.7] - 2025-03-04 +## [0.4.7] 2025-03-04 ### Added diff --git a/src/Geometry.jl b/src/Geometry.jl index 64398c9..7503339 100644 --- a/src/Geometry.jl +++ b/src/Geometry.jl @@ -123,6 +123,18 @@ function Geometry.add_tag_from_tags!(labels::DistributedFaceLabeling, name, tags end end +function Geometry.add_tag_from_tags_complementary!(labels::DistributedFaceLabeling, name::String, tag) + map(local_views(labels)) do labels + Geometry.add_tag_from_tags_complementary!(labels,name,tag) + end +end + +function Geometry.add_tag_from_tags_setdiff!(labels::DistributedFaceLabeling, name::String, tag1, tag2) + map(local_views(labels)) do labels + Geometry.add_tag_from_tags_setdiff!(labels,name,tag1,tag2) + end +end + function Geometry.get_face_mask(labels::DistributedFaceLabeling, tags, d::Integer) map(local_views(labels)) do labels get_face_mask(labels, tags, d) @@ -579,6 +591,30 @@ end # Triangulation constructors +function Geometry.Triangulation(model::DistributedDiscreteModel, args...;kwargs...) + D = num_cell_dims(model) + Triangulation(no_ghost,ReferenceFE{D},model, args...;kwargs...) +end + +function Geometry.Triangulation(::Type{ReferenceFE{D}},model::DistributedDiscreteModel, args...;kwargs...) where D + Triangulation(no_ghost, ReferenceFE{D}, model, args...; kwargs...) +end + +function Geometry.Triangulation(portion, model::DistributedDiscreteModel, args...;kwargs...) + D = num_cell_dims(model) + Triangulation(portion,ReferenceFE{D},model, args...;kwargs...) +end + +function Geometry.Triangulation( + portion,::Type{ReferenceFE{D}},model::DistributedDiscreteModel, args...;kwargs...) where D + gids = get_face_gids(model,D) + trians = map(local_views(model)) do model + Triangulation(ReferenceFE{D},model, args...;kwargs...) + end + parent = DistributedTriangulation(trians,model) + return filter_cells_when_needed(portion,gids,parent) +end + function Geometry.Triangulation(model::DistributedDiscreteModel;kwargs...) D = num_cell_dims(model) Triangulation(no_ghost,ReferenceFE{D},model;kwargs...) diff --git a/src/Visualization.jl b/src/Visualization.jl index 0535e22..40a16c2 100644 --- a/src/Visualization.jl +++ b/src/Visualization.jl @@ -222,13 +222,35 @@ end struct DistributedPvd{T<:AbstractArray} pvds::T + parts::AbstractArray +end + +function Visualization.createpvd(trian::DistributedTriangulation,parts::AbstractArray,args...;kwargs...) + nparts, new_parts = filter_empty_parts(parts,local_views(trian)) + pvds = map(new_parts) do part + if part == 1 + paraview_collection(args...;kwargs...) + end + end + DistributedPvd(pvds,new_parts) +end + +function Visualization.createpvd(f,trian::DistributedTriangulation,parts::AbstractArray,args...;kwargs...) + pvd = createpvd(trian,parts,args...;kwargs...) + try + f(pvd) + finally + savepvd(pvd) + end end function Visualization.createpvd(parts::AbstractArray,args...;kwargs...) - pvds = map_main(parts) do part - paraview_collection(args...;kwargs...) + pvds = map(parts) do part + if part == 1 + paraview_collection(args...;kwargs...) + end end - DistributedPvd(pvds) + DistributedPvd(pvds,parts) end function Visualization.createpvd(f,parts::AbstractArray,args...;kwargs...) @@ -241,14 +263,22 @@ function Visualization.createpvd(f,parts::AbstractArray,args...;kwargs...) end function Visualization.savepvd(pvd::DistributedPvd) - map_main(pvd.pvds) do pvd - vtk_save(pvd) + map(pvd.pvds, pvd.parts) do pvd, part + if part == 1 + vtk_save(pvd) + end end end function Base.setindex!(pvd::DistributedPvd,pvtk::AbstractArray,time::Real) - map(vtk_save,pvtk) - map_main(pvtk,pvd.pvds) do pvtk,pvd - pvd[time] = pvtk + map(pvtk) do pvtk + if !isnothing(pvtk) + vtk_save(pvtk) + end + end + map(pvtk,pvd.pvds,pvd.parts) do pvtk,pvd,part + if part == 1 + pvd[time] = pvtk + end end end