Skip to content

Commit 62469e3

Browse files
committed
Update docs
1 parent 815a611 commit 62469e3

File tree

3 files changed

+48
-10
lines changed

3 files changed

+48
-10
lines changed

docs/src/solidmodels.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,47 @@ Other operations:
6868

6969
### Meshing
7070

71-
Entities can carry mesh sizing information with them when rendered to a `SolidModel`. Many entities will default to a maximal size to reasonably resolve the geometry. This is particularly useful together with adaptive mesh refinement to efficiently refine your mesh to minimize estimated error with as few elements as possible. You can also style entities with [`MeshSized`](@ref) to manually control mesh sizing, and provide `MeshingParameters` to `render!` using the `meshing_parameters` keyword argument.
71+
Entities can carry mesh sizing information with them when rendered to a `SolidModel`. Many
72+
entities will default to a maximal size to reasonably resolve the geometry. This is
73+
particularly useful together with adaptive mesh refinement to efficiently refine your mesh
74+
to minimize estimated error with as few elements as possible. You can also style entities
75+
with [`MeshSized`](@ref) to manually control mesh sizing, the [`SolidModels.mesh_scale`](@ref),
76+
[`SolidModels.mesh_order`](@ref) and [`SolidModels.mesh_grading_default`](@ref) methods are used to modify the
77+
global default parameters used in each sizing field (see [`MeshSized`](@ref)).
78+
79+
Size fields within a `SolidModel` are specified in terms of control points, which are
80+
spatial locations combined with an `(h, α)` as in [`MeshSized`](@ref). When a model is
81+
rendered, a set of control points are computed from the geometry, and these are then used to
82+
create `KDTree` structures to allow for rapid evaluation. Additional points can be manually
83+
inserted into a `SolidModel` after `render!` is called, and the global size parameters
84+
[`SolidModels.mesh_scale`](@ref), [`SolidModels.mesh_order`](@ref) and [`SolidModels.mesh_grading_default`](@ref) modified without requiring `render!`
85+
to be called again. This allows for iteration on the mesh for a given fixed geometry. Manual
86+
modification of the control points is in general not necessary but can be achieved through
87+
[`DeviceLayout.SolidModels.add_mesh_size_point`](@ref), [`DeviceLayout.SolidModels.finalize_size_fields!`](@ref),
88+
[`DeviceLayout.SolidModels.clear_mesh_control_points!`](@ref) and
89+
[`DeviceLayout.SolidModels.reset_mesh_control!`](@ref).
90+
91+
!!! info
92+
93+
If [`SolidModels.mesh_control_points`](@ref) is modified, then it is important to call
94+
[`SolidModels.finalize_size_fields!`](@ref) in order to ensure that the `KDTree` are rebuilt.
95+
Additionally, to generate a new mesh `SolidModels.gmsh.model.mesh.clear()` must be called
96+
otherwise `gmsh` will return only any previously generated mesh.
7297

7398
```@docs
7499
SolidModels.MeshingParameters
100+
SolidModels.mesh_order
101+
SolidModels.mesh_scale
102+
SolidModels.mesh_grading_default
103+
SolidModels.set_gmsh_option
104+
SolidModels.get_gmsh_number
105+
SolidModels.get_gmsh_string
106+
SolidModels.mesh_control_points
107+
SolidModels.mesh_control_trees
108+
SolidModels.add_mesh_size_point
109+
SolidModels.finalize_size_fields!
110+
SolidModels.clear_mesh_control_points!
111+
SolidModels.reset_mesh_control!
75112
```
76113

77114
## Example

src/solidmodels/render.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ Returns a `Dict{Tuple{Float64, Float64}, Vector{SVector{3, Float64}}}` where key
611611
`(mesh_size, grading_parameter)` tuples and values are vectors of 3D points.
612612
613613
If this dictionary is modified, by erasing points or adding points using
614-
[`add_mesh_size_point`](@ref), then it is necessary to call [`finalize_size_fields`](@ref)
614+
[`add_mesh_size_point`](@ref), then it is necessary to call [`finalize_size_fields!`](@ref)
615615
to rebuild the KDTree from the data, else any resulting mesh will not reflect the change in
616616
data.
617617
"""
@@ -660,10 +660,11 @@ end
660660
options::Dict{String, Float64} = Dict{String, Float64}()
661661
end
662662
663+
α
664+
663665
!!! warning "Deprecated"
664666
665-
This struct is deprecated. Use [`mesh_scale`](@ref), [`mesh_grading_default`](@ref),
666-
[`mesh_order`](@ref), and [`gmsh_option`](@ref) instead.
667+
This struct is deprecated. See [`render!`](@ref)
667668
668669
MeshingParameters contains high level parameters to specify mesh sizing
669670
fields throughout the domain.
@@ -734,14 +735,14 @@ Render `cs` to `sm`.
734735
Map all metadata to zero.
735736
- `gmsh_options`: Dictionary of gmsh option name-value pairs to set before meshing.
736737
- `meshing_parameters`: **Deprecated.** Use individual mesh control functions
737-
[`mesh_scale`](@ref), [`mesh_order`](@ref) and [`mesh_grading_default`](@ref), along with
738+
[`DeviceLayout.SolidModels.mesh_scale`](@ref), [`DeviceLayout.SolidModels.mesh_order`](@ref) and [`DeviceLayout.SolidModels.mesh_grading_default`](@ref), along with
738739
`gmsh_options` instead.
739740
740741
Available postrendering operations include [`translate!`](@ref), [`extrude_z!`](@ref), [`revolve!`](@ref),
741742
[`union_geom!`](@ref), [`intersect_geom!`](@ref), [`difference_geom!`](@ref), [`fragment_geom!`](@ref), and [`box_selection`](@ref).
742743
(The geometric Boolean operations are only available for models using the OpenCASCADE kernel.)
743744
744-
Additional keyword arguments are passed to [`SolidModels.to_primitives`](@ref) (which falls back to
745+
Additional keyword arguments are passed to [`DeviceLayout.SolidModels.to_primitives`](@ref) (which falls back to
745746
[`to_polygons`](@ref)) and may be used for
746747
certain entity types to control how entities of `cs` are converted to primitives and added to `sm`.
747748
"""

src/styles.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ mesh size = h * max(s_g, (d/h)^α)
158158
```
159159
160160
where d is the distance away from the styled entity, and `s_g` is the global mesh scale
161-
parameter specified in [`SolidModels.mesh_scale`](@ref). A smaller value of `h` will give a finer mesh
161+
parameter specified in [`DeviceLayout.SolidModels.mesh_scale`](@ref). A smaller value of `h` will give a finer mesh
162162
attached to the styled entity, and a larger value of `α` will give a more rapid increase in
163163
size away from the styled entity.
164164
165-
If `α < 0`, the size field will use [`SolidModels.mesh_grading_default`](@ref) used in rendering.
165+
If `α < 0`, the size field will use [`DeviceLayout.SolidModels.mesh_grading_default`](@ref) used in rendering.
166166
167167
See also [`meshsized_entity`](@ref).
168168
"""
@@ -183,11 +183,11 @@ mesh size = h * max(s_g, (d/h)^α)
183183
```
184184
185185
where d is the distance away from the styled entity, and `s_g` is the global mesh scale
186-
parameter specified in [`SolidModels.mesh_scale`](@ref). A smaller value of `h` will give a finer mesh
186+
parameter specified in [`DeviceLayout.SolidModels.mesh_scale`](@ref). A smaller value of `h` will give a finer mesh
187187
attached to the styled entity, and a larger value of `α` will give a more rapid increase in
188188
size away from the styled entity.
189189
190-
If `α < 0`, the size field will use [`SolidModels.mesh_grading_default`](@ref) used in rendering.
190+
If `α < 0`, the size field will use [`DeviceLayout.SolidModels.mesh_grading_default`](@ref) used in rendering.
191191
"""
192192
meshsized_entity(ent::GeometryEntity, h::T, α::S=-1.0) where {T, S <: Real} =
193193
MeshSized(h, α)(ent)

0 commit comments

Comments
 (0)