@@ -8211,6 +8211,65 @@ end propagateModFinal;
82118211public type DomainFieldOpt = Option < tuple< Absyn . ComponentRef ,DAE . ComponentRef >> ;
82128212public type DomainFieldsLst = list< tuple< DAE . ComponentRef ,list< Absyn . ComponentRef >>>;
82138213
8214+ public function addGhostCells
8215+ // add ghost cells to fields that are differentiated in pder
8216+ input list< tuple< SCode . Element , DAE . Mod >> inCompelts;
8217+ input list< SCode . Equation > inEqs;
8218+ output list< tuple< SCode . Element , DAE . Mod >> outCompelts;
8219+ protected list< Absyn . Ident > fieldNamesP;
8220+ algorithm
8221+ fieldNamesP := List . fold(inEqs, fieldsInPderEq, {});
8222+ // TODO: implement
8223+
8224+
8225+ outCompelts := inCompelts;
8226+ end addGhostCells;
8227+
8228+ function fieldsInPderEq
8229+ // adds field variable names that are differentiated using pder
8230+ // in given equation to given list if it isn't already there
8231+ input SCode . Equation eq;
8232+ input list< Absyn . Ident > inFieldNames;
8233+ output list< Absyn . Ident > outFieldNames;
8234+ protected list< Absyn . Ident > fieldNames2;
8235+ algorithm
8236+ fieldNames2 := match eq
8237+ local
8238+ list< Absyn . Ident > fieldNames1;
8239+ Absyn . Exp lhs_exp, rhs_exp;
8240+ case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp))
8241+ /* ,domain = domainCr as Absyn.CREF_IDENT(), comment = comment, info = info))*/
8242+ algorithm
8243+ (_,fieldNames1) := Absyn . traverseExp(lhs_exp, fieldInPderExp, inFieldNames);
8244+ (_,fieldNames1) := Absyn . traverseExp(rhs_exp, fieldInPderExp, fieldNames1);
8245+ then
8246+ fieldNames1;
8247+ else
8248+ inFieldNames;
8249+ end match;
8250+ outFieldNames := fieldNames2;
8251+ end fieldsInPderEq;
8252+
8253+ function fieldInPderExp
8254+ // if given expression is pder call, than adds the differentiated field name
8255+ // to given list of names if it is not already there
8256+ input Absyn . Exp inExp;
8257+ input list< Absyn . Ident > inFieldNames;
8258+ output Absyn . Exp outExp;
8259+ output list< Absyn . Ident > outFieldNames;
8260+ algorithm
8261+ outFieldNames := match inExp
8262+ local
8263+ Absyn . Ident newFieldName;
8264+ case Absyn . CALL (function_= Absyn . CREF_IDENT (name= "pder" ),functionArgs= Absyn . FUNCTIONARGS (args= {Absyn . CREF (Absyn . CREF_IDENT (name= newFieldName)),_}))
8265+ then
8266+ List . unionElt(newFieldName,inFieldNames);
8267+ else
8268+ inFieldNames;
8269+ end match;
8270+ outExp := inExp;
8271+ end fieldInPderExp;
8272+
82148273public function elabField
82158274// For field variables: finds the "domain" modifier,
82168275// finds domain.N - length of discretized field array
0 commit comments