@@ -177,9 +177,10 @@ public
177177 function split
178178 "Splits a connector into its primitive components."
179179 input Connector conn;
180+ input Boolean splitArrays = Flags . isSet(Flags . NF_SCALARIZE );
180181 output list< Connector > connl;
181182 algorithm
182- connl := splitImpl(conn. name, conn. ty, conn. face, conn. source, conn. cty);
183+ connl := splitImpl(conn. name, conn. ty, conn. face, conn. source, conn. cty, splitArrays );
183184 end split;
184185
185186protected
@@ -205,8 +206,9 @@ protected
205206 input Face face;
206207 input DAE . ElementSource source;
207208 input ConnectorType cty;
209+ input Boolean splitArrays;
208210 input output list< Connector > conns = {};
209- input list< Dimension > dims = {} "accumulated dimensions if not NF_SCALARIZE " ;
211+ input list< Dimension > dims = {} "accumulated dimensions if splitArrays = false " ;
210212 algorithm
211213 conns := match ty
212214 local
@@ -216,30 +218,30 @@ protected
216218
217219 case Type . COMPLEX (complexTy = ct as ComplexType . CONNECTOR ())
218220 algorithm
219- conns := splitImpl2(name, face, source, ct. potentials, conns, dims);
220- conns := splitImpl2(name, face, source, ct. flows, conns, dims);
221- conns := splitImpl2(name, face, source, ct. streams, conns, dims);
221+ conns := splitImpl2(name, face, source, ct. potentials, splitArrays, conns, dims);
222+ conns := splitImpl2(name, face, source, ct. flows, splitArrays, conns, dims);
223+ conns := splitImpl2(name, face, source, ct. streams, splitArrays, conns, dims);
222224 then
223225 conns;
224226
225227 case Type . COMPLEX ()
226228 algorithm
227229 tree := Class . classTree(InstNode . getClass(ty. cls));
228230 conns := splitImpl2(name, face, source,
229- arrayList(ClassTree . getComponents(tree)), conns, dims);
231+ arrayList(ClassTree . getComponents(tree)), splitArrays, conns, dims);
230232 then
231233 conns;
232234
233235 case Type . ARRAY ()
234236 algorithm
235237 t := Type . arrayElementType(ty);
236- if Flags . isSet( Flags . NF_SCALARIZE ) then
238+ if splitArrays then
237239 for c in ComponentRef . scalarize(name) loop
238- conns := splitImpl(c, t, face, source, cty, conns, dims);
240+ conns := splitImpl(c, t, face, source, cty, splitArrays, conns, dims);
239241 end for ;
240242 else
241243 if not Type . isEmptyArray(ty) then
242- conns := splitImpl(name, t, face, source, cty, conns,
244+ conns := splitImpl(name, t, face, source, cty, splitArrays, conns,
243245 listAppend(dims, ty. dimensions));
244246 end if ;
245247 end if ;
@@ -255,6 +257,7 @@ protected
255257 input Face face;
256258 input DAE . ElementSource source;
257259 input list< InstNode > comps;
260+ input Boolean splitArrays;
258261 input output list< Connector > conns;
259262 input list< Dimension > dims;
260263 protected
@@ -268,7 +271,7 @@ protected
268271 ty := Component . getType(c);
269272 cty := Component . connectorType(c);
270273 cref := ComponentRef . append(ComponentRef . fromNode(comp, ty), name);
271- conns := splitImpl(cref, ty, face, source, cty, conns, dims);
274+ conns := splitImpl(cref, ty, face, source, cty, splitArrays, conns, dims);
272275 end for ;
273276 end splitImpl2;
274277
0 commit comments