You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
calls the nodevalues_subset! function with all nodes of the dofgrid, see nodevalues_subset!(target, source, FE, operator; nodes = 1:num_nodes(FE.dofgrid), kwargs...)
Evaluate a finite element function (given by the coefficient vector `source` and FE space `FE`) at all nodes, but store the results in a piecewise (cellwise) fashion, i.e., for each cell, the values at its local nodes are written into `target`. The result is organized so that each column of `target` corresponds to a cell, and each row corresponds to the values at the cell's nodes.
277
+
Evaluate a finite element function (given by the coefficient vector `source` and FE space `FE`) at all nodes of the grid, applying an optional function operator, and write the results into `target`.
278
+
279
+
By default, the function is evaluated at every node in the mesh. If `continuous` is `false`, the value at each node is averaged over all neighboring cells (suitable for discontinuous quantities). If `continuous` is `true`, the value is taken from a single cell per node (suitable for continuous quantities). The result can optionally be scaled, offset, or restricted to specific regions.
303
280
304
281
# Arguments
305
-
- `target`: Output array to store the evaluated values (size: result dimension × number of nodes per cell, number of cells).
282
+
- `target`: Output array to store the evaluated values (size: result dimension × number of nodes).
306
283
- `source`: Coefficient vector for the FE function.
307
284
- `FE`: The finite element space.
308
-
- `operator`: Function operator to apply (default: `Identity`).
285
+
- `operator`: Function operator to apply at each node (default: `Identity`).
286
+
287
+
# Keyword Arguments
309
288
- `abs`: If `true`, store the Euclidean norm of the result at each node (default: `false`).
310
289
- `factor`: Scaling factor applied to the result (default: `1`).
311
290
- `regions`: List of region indices to restrict evaluation (default: all regions).
@@ -316,8 +295,11 @@ Evaluate a finite element function (given by the coefficient vector `source` and
316
295
317
296
# Notes
318
297
- The result dimension is determined by the FE space, the operator, and the `abs` argument.
298
+
- The function modifies `target` in-place.
299
+
- For vector-valued or higher-dimensional results, the first dimension of `target` corresponds to the result dimension.
300
+
319
301
"""
320
-
functionpiecewise_nodevalues!(
302
+
functionnodevalues!(
321
303
target::AbstractArray{T, 2},
322
304
source::AbstractArray{T, 1},
323
305
FE::FESpace{Tv, Ti, FEType, AT},
@@ -327,7 +309,8 @@ function piecewise_nodevalues!(
327
309
regions::Array{Int, 1}= [0],
328
310
target_offset::Int=0,
329
311
source_offset::Int=0,
330
-
zero_target::Bool=true
312
+
zero_target::Bool=true,
313
+
continuous::Bool=false
331
314
) where {T, Tv, Ti, FEType, AT}
332
315
333
316
xgrid = FE.dofgrid
@@ -354,11 +337,14 @@ function piecewise_nodevalues!(
354
337
fill!(target, 0)
355
338
end
356
339
340
+
nnodes::Int=num_sources(xgrid[Coordinates])
341
+
nneighbours::Array{Int, 1}=zeros(Int, nnodes)
342
+
flag4node::Array{Bool, 1}=zeros(Bool, nnodes)
343
+
357
344
functionbarrier(EG, qf, BE)
358
345
node::Int=0
359
346
dof::Ti=0
360
347
weights::Array{T, 1}= qf.w
361
-
nweights =length(weights)
362
348
basisvals = BE.cvals
363
349
ndofs =size(basisvals, 2)
364
350
cvals_resultdim::Int=size(basisvals, 1)
@@ -378,32 +364,29 @@ function piecewise_nodevalues!(
Evaluate a finite element function (given by the coefficient vector `source` and FE space `FE`) at all nodes of the grid, applying an optional function operator, and write the results into `target`.
442
-
443
-
By default, the function is evaluated at every node in the mesh. If `continuous` is `false`, the value at each node is averaged over all neighboring cells (suitable for discontinuous quantities). If `continuous` is `true`, the value is taken from a single cell per node (suitable for continuous quantities). The result can optionally be scaled, offset, or restricted to specific regions.
438
+
Evaluate a finite element function (given by the coefficient vector `source` and FE space `FE`) at all nodes, but store the results in a piecewise (cellwise) fashion, i.e., for each cell, the values at its local nodes are written into `target`. The result is organized so that each column of `target` corresponds to a cell, and each row corresponds to the values at the cell's nodes.
444
439
445
440
# Arguments
446
-
- `target`: Output array to store the evaluated values (size: result dimension × number of nodes).
441
+
- `target`: Output array to store the evaluated values (size: result dimension × number of nodes per cell, number of cells).
447
442
- `source`: Coefficient vector for the FE function.
448
443
- `FE`: The finite element space.
449
-
- `operator`: Function operator to apply at each node (default: `Identity`).
450
-
451
-
# Keyword Arguments
444
+
- `operator`: Function operator to apply (default: `Identity`).
452
445
- `abs`: If `true`, store the Euclidean norm of the result at each node (default: `false`).
453
446
- `factor`: Scaling factor applied to the result (default: `1`).
454
447
- `regions`: List of region indices to restrict evaluation (default: all regions).
@@ -459,11 +452,8 @@ By default, the function is evaluated at every node in the mesh. If `continuous`
459
452
460
453
# Notes
461
454
- The result dimension is determined by the FE space, the operator, and the `abs` argument.
462
-
- The function modifies `target` in-place.
463
-
- For vector-valued or higher-dimensional results, the first dimension of `target` corresponds to the result dimension.
0 commit comments