Changeset 0d11bbe in OpenModelica
- Timestamp:
- 2016-04-08T13:46:23+02:00 (8 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 027b44e2
- Parents:
- fc4de9ec
- git-author:
- ptaeuber <patrick_marcel.taeuber@…> (04/08/16 12:50:33)
- git-committer:
- ptaeuber <patrick_marcel.taeuber@…> (04/08/16 13:46:23)
- Location:
- Compiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Compiler/BackEnd/Tearing.mo
r7d8f15f2 r0d11bbe 60 60 protected import ExpressionSolve; 61 61 protected import Flags; 62 protected import Global; 62 63 protected import List; 63 64 protected import Matching; … … 96 97 TearingMethod method; 97 98 BackendDAE.BackendDAEType DAEtype; 99 Integer strongComponentIndex = System.tmpTickIndex(Global.strongComponent_index); 98 100 99 101 // if noTearing is selected, do nothing. … … 105 107 // get method function and traverse systems 106 108 case(_) equation 109 107 110 methodString = Config.getTearingMethod(); 108 111 BackendDAE.SHARED(backendDAEType=DAEtype) = inDAE.shared; … … 114 117 print("!\n" + UNDERLINE + UNDERLINE + "\n"); 115 118 end if; 116 (outDAE, _) = BackendDAEUtil.mapEqSystemAndFold(inDAE, tearingSystemWork, method); 119 (outDAE, (_,strongComponentIndex)) = BackendDAEUtil.mapEqSystemAndFold(inDAE, tearingSystemWork, (method, strongComponentIndex)); 120 System.tmpTickSetIndex(strongComponentIndex, Global.strongComponent_index); 117 121 then outDAE; 118 122 … … 185 189 input BackendDAE.EqSystem isyst; 186 190 input BackendDAE.Shared inShared; 187 input TearingMethod inTearingMethod;191 input tuple<TearingMethod,Integer> inTearingMethodAndIndex; 188 192 output BackendDAE.EqSystem osyst; 189 193 output BackendDAE.Shared outShared = inShared "unused"; 190 output TearingMethod outTearingMethod = inTearingMethod "unused"; 191 protected 194 output tuple<TearingMethod,Integer> outTearingMethodAndIndex; 195 protected 196 TearingMethod inTearingMethod = Util.tuple21(inTearingMethodAndIndex); 197 Integer strongComponentIndex = Util.tuple22(inTearingMethodAndIndex); 192 198 BackendDAE.StrongComponents comps; 193 199 Boolean b; … … 198 204 print("\n" + BORDER + "\nBEGINNING of traverseComponents\n\n"); 199 205 end if; 200 (comps, b ) := traverseComponents(comps, isyst, inShared, inTearingMethod);206 (comps, b, strongComponentIndex) := traverseComponents(comps, isyst, inShared, inTearingMethod, strongComponentIndex); 201 207 if Flags.isSet(Flags.TEARING_DUMPVERBOSE) then 202 208 print("\nEND of traverseComponents\n" + BORDER + "\n\n"); 203 209 end if; 204 210 osyst := if b then BackendDAEUtil.setEqSystMatching(isyst, BackendDAE.MATCHING(ass1, ass2, comps)) else isyst; 211 outTearingMethodAndIndex := (inTearingMethod,strongComponentIndex); 205 212 end tearingSystemWork; 206 213 … … 210 217 input BackendDAE.Shared ishared; 211 218 input TearingMethod inMethod; 219 input Integer strongComponentIndexIn; 212 220 output BackendDAE.StrongComponents oComps; 213 221 output Boolean outRunMatching = false; 222 output Integer strongComponentIndexOut=strongComponentIndexIn; 214 223 algorithm 215 224 oComps := list(match co … … 219 228 case comp 220 229 equation 221 (comp, b ) = traverseComponents1(comp, isyst, ishared, inMethod);230 (comp, b, strongComponentIndexOut) = traverseComponents1(comp, isyst, ishared, inMethod, strongComponentIndexOut); 222 231 outRunMatching = outRunMatching or b; 223 232 then comp; … … 230 239 input BackendDAE.Shared ishared; 231 240 input TearingMethod inMethod; 241 input Integer strongComponentIndexIn; 232 242 output BackendDAE.StrongComponent oComp; 233 243 output Boolean outRunMatching; 244 output Integer strongComponentIndexOut=strongComponentIndexIn; 234 245 protected 235 246 constant Boolean debug = false; 236 247 algorithm 248 strongComponentIndexOut := match(inComp) 249 case(BackendDAE.EQUATIONSYSTEM(jac=BackendDAE.FULL_JACOBIAN())) equation 250 if Flags.isSet(Flags.TEARING_DUMP) or Flags.isSet(Flags.TEARING_DUMPVERBOSE) then 251 print("Handle strong component with index: " + intString(strongComponentIndexOut+1) + "\nTo disable tearing of this component use '--noTearingForComponent=" + intString(strongComponentIndexOut+1) + "'.\n"); 252 end if; 253 then (strongComponentIndexOut + 1); 254 else strongComponentIndexOut; 255 end match; 256 237 257 (oComp, outRunMatching) := matchcontinue (inComp, isyst, ishared, inMethod) 238 258 local … … 254 274 end if; 255 275 if Flags.isSet(Flags.TEARING_DUMP) or Flags.isSet(Flags.TEARING_DUMPVERBOSE) then 256 print("\n Case linear in traverseComponents\nUse Flag '+d=tearingdumpV' for more details\n\n");276 print("\nTearing of LINEAR component\nUse Flag '+d=tearingdumpV' for more details\n\n"); 257 277 end if; 258 278 false = Flags.getConfigBool(Flags.DISABLE_LINEAR_TEARING); … … 278 298 end if; 279 299 if Flags.isSet(Flags.TEARING_DUMP) or Flags.isSet(Flags.TEARING_DUMPVERBOSE) then 280 print("\n Case non-linear in traverseComponents\nUse Flag '+d=tearingdumpV' for more details\n\n");300 print("\nTearing of NONLINEAR component\nUse Flag '+d=tearingdumpV' for more details\n\n"); 281 301 end if; 282 302 if Flags.isSet(Flags.TEARING_DUMPVERBOSE) then -
Compiler/Global/Global.mo
r8f17d04 r0d11bbe 73 73 // csevar name 74 74 constant Integer backendDAE_cseIndex = 23; 75 // strong component index 76 constant Integer strongComponent_index = 24; 75 77 76 78 // ----------------------
Note: See TracChangeset
for help on using the changeset viewer.