@@ -8,6 +8,7 @@ struct IGAShellAdaptivity{T}
8
8
cellstates:: Vector{CELLSTATE}
9
9
control_point_states:: Vector{CPSTATE}
10
10
propagation_checked:: Matrix{Bool}
11
+ locked_elements:: Vector{Int}
11
12
locked_control_points:: Vector{Int}
12
13
13
14
lumped2layered:: IGA.BezierExtractionOperator{T}
@@ -32,7 +33,6 @@ function get_controlpoint_state(adap::IGAShellAdaptivity, cpid::Vector{Int})
32
33
return adap. control_point_states[cpid]
33
34
end
34
35
35
-
36
36
function set_controlpoint_state! (adap:: IGAShellAdaptivity , cpid:: Int , state:: CPSTATE )
37
37
adap. control_point_states[cpid] = state
38
38
end
@@ -41,7 +41,7 @@ function setcellstate!(adap::IGAShellAdaptivity, cellid::Int, state::CELLSTATE)
41
41
adap. cellstates[cellid] = state
42
42
end
43
43
44
- function IGAShellAdaptivity (data:: IGAShellData{dim_p,dim_s,T} , cell_connectivity :: Matrix{Int} , ncells, nnodes ) where {dim_p,dim_s,T}
44
+ function IGAShellAdaptivity (data:: IGAShellData{dim_p,dim_s,T} , ncells) where {dim_p,dim_s,T}
45
45
46
46
order = data. orders[dim_s]
47
47
ninterfaces = data. nlayers- 1
@@ -66,49 +66,58 @@ function IGAShellAdaptivity(data::IGAShellData{dim_p,dim_s,T}, cell_connectivity
66
66
Cla2di = IGA. bezier_extraction_to_vector (Cmat_la2di' )
67
67
Clu2di = IGA. bezier_extraction_to_vector (Cmat_lu2di' )
68
68
69
+ propagation_checked = [false for _ in 1 : ninterfaces, _ in 1 : ncells]
70
+
71
+ node_states = CPSTATE[] # initialized later in _init_cpstates_cellstates
72
+ locked_control_points = Int[]
73
+
74
+ return IGAShellAdaptivity (data. initial_cellstates, node_states, propagation_checked, data. locked_elements, locked_control_points,
75
+ Clu2la, Cla2di, Clu2di,
76
+ weakdiscont2discont, strongdiscont2discont,
77
+ interface_knots, order)
78
+ end
79
+
80
+ function _init_cpstates_cellstates! (dh:: Ferrite.AbstractDofHandler , igashell)
81
+
82
+ nnodes = get_n_controlpoints (igashell. layerdata)
83
+ cellnodes = igashell. cache. cellnodes
84
+
69
85
# Some of the cells will be initialized with LUMPED, and some with LYARED/DISCONTINIUOS
70
86
# This means that some cells will be in a mixed mode... Determine those
71
87
# Prioritize the DISCONTINIUOS before LAYERED and LUMPED, ie. if one node is both lumped
72
88
# and disocontinous, choose it to be dinscontionous
73
89
node_states = fill (LUMPED_CPSTATE, nnodes)
74
90
75
- for cellid in 1 : ncells
76
- cellstate = data. initial_cellstates[cellid]
77
- for cellnodes in cell_connectivity[:, cellid]
78
- for nodeid in cellnodes
79
- node_states[nodeid] = combine_states (node_states[nodeid], first (cellstate. cpstates), ninterfaces)
80
- end
91
+ for cellid in 1 : getncells (igashell)
92
+ cellstate = igashell. adaptivity. cellstates[cellid]
93
+ Ferrite. cellnodes! (cellnodes, dh, cellid)
94
+ for nodeid in cellnodes
95
+ node_states[nodeid] = combine_states (node_states[nodeid], first (cellstate. cpstates), ninterfaces (igashell))
81
96
end
97
+
82
98
end
83
99
84
100
# Check if there is any cell that is has MIXED states controlpoints
85
- for cellid in 1 : ncells
86
- nodeids = cell_connectivity[: , cellid]
87
- cellnode_states = node_states[nodeids ]
101
+ for cellid in 1 : getncells (igashell)
102
+ Ferrite . cellnodes! (cellnodes, dh , cellid)
103
+ cellnode_states = node_states[cellnodes ]
88
104
89
105
# if NOT all of the nodes in the cell are equal, the element is mixed
90
106
if ! all (first (cellnode_states) .== cellnode_states)
91
- data . initial_cellstates [cellid] = CELLSTATE (_MIXED, copy (cellnode_states))
107
+ igashell . adaptivity . cellstates [cellid] = CELLSTATE (_MIXED, copy (cellnode_states))
92
108
end
93
109
94
110
end
95
-
96
- propagation_checked = [false for _ in 1 : ninterfaces, _ in 1 : ncells]
97
111
98
112
# Some cells are not allowed to be upgraded (locked).. store the contorl points of these cells
99
- locked_control_points = Int[]
100
- for cellid in data. locked_elements
101
- for cell_nodes in cell_connectivity[:, cellid]
102
- for nodeid in cell_nodes
103
- push! (locked_control_points, nodeid)
104
- end
113
+ for cellid in igashell. adaptivity. locked_elements
114
+ Ferrite. cellnodes! (cellnodes, dh, cellid)
115
+ for nodeid in cellnodes
116
+ push! (igashell. adaptivity. locked_control_points, nodeid)
105
117
end
106
118
end
107
119
108
- return IGAShellAdaptivity (data. initial_cellstates, node_states, propagation_checked, locked_control_points,
109
- Clu2la, Cla2di, Clu2di,
110
- weakdiscont2discont, strongdiscont2discont,
111
- interface_knots, order)
120
+ Ferrite. copy!! (igashell. adaptivity. control_point_states, node_states)
112
121
end
113
122
114
123
function get_upgrade_operator (adap:: IGAShellAdaptivity , from:: CPSTATE , to:: CPSTATE )
0 commit comments