<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.hoenzb
{mso-style-name:hoenzb;}
span.E-MailFormatvorlage18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.E-MailFormatvorlage19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Kevin,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">thanks a lot for your help! Both solutions reduced the runtime of the CopyObjectHierarchy function significantly.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">We thought that swiching-off the roll-back capability would accelerate a GReAT transformation in general, but the tests we conducted did not reveal
any benefits beside the ones with the CopyObjectHierarchy function. Could you maybe explain which parts of a transformation are influenced by the roll-back capability, please?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Tim<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Von:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> great-users [mailto:great-users-bounces@list.isis.vanderbilt.edu]
<b>Im Auftrag von </b>Kevin Smyth<br>
<b>Gesendet:</b> Mittwoch, 20. September 2017 22:07<br>
<b>An:</b> A list for GReAT users to share bugs, fixes and ideas<br>
<b>Betreff:</b> Re: [great-users] Udm CopyObjectHierarchy function duration increases during transformation<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Tim,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Unfortunately, GME is slow and gets slower under the default configuration, which enables it to roll back illegal operations. Here's code to disable the roll-back capability in the GReAT code generator's ...._main.cpp output file:<br>
<br>
#include "Mga.idl" // from $(GME_ROOT)\Interfaces<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">....<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">// get objects from DNs<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">UMLModelTransformer::RootFolder rootUMLModelTransformer_552= UMLModelTransformer::RootFolder::Cast( uMLModelTransformer_ref_54b.GetRootObject());<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">StructureTestDSL::RootFolder rootStructureTestDSL_553= StructureTestDSL::RootFolder::Cast( structureTestDSL_ref_54e.GetRootObject());<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">// new code starts here:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">// disable nested transactions for output model<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">IUnknown* gmeFco = UdmGme::Udm2Gme(sdnUMLModelTransformer_549.GetRootObject());<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">IMgaObject* gmeFcoPtr = NULL;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">gmeFco->QueryInterface(__uuidof(IMgaObject), (void**)&gmeFcoPtr);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">IMgaProject* project = NULL;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">gmeFcoPtr->get_Project(&project);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">long prefs;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">project->get_Preferences(&prefs);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">project->put_Preferences(MGAPREF_NO_NESTED_TX | prefs);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">gmeFcoPtr->Release();<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">project->Release();<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">gmeFco->Release();<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">// new code ends<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">// Add objects to input packets.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">templateModels_1.push_back( rootStructureTestDSL_553);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">trafos_3.push_back( rootUMLModelTransformer_552);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">// Get access to temporary root object(s).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">g_Crosslinks__GlobalRootContainer= Crosslinks::GlobalRootContainer::Cast( crosslinks_ref_551.GetRootObject());<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">// transformation<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Start_0 start_0;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">start_0( templateModels_1, trafos_3);<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Alternatively, you can commit the GME transaction before running UdmUtil::CopyObjectHierarchy:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">#include "UdmGme.h"<br>
....<br>
((UdmGme::GmeDataNetwork*)fromObj.__impl()->__getdn())->CommitEditSequence();<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">GME will be able to roll back operations, but this will reduce the slowdown.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">You should add error checking, e.g. in case the output file is not a GME file.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Kevin<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Thu, Sep 14, 2017 at 6:48 AM, Belschner, Tim <<a href="mailto:tim.belschner@ils.uni-stuttgart.de" target="_blank">tim.belschner@ils.uni-stuttgart.de</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hello everybody,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">based on the generated code for the GReAT Group operator, we built up a cpp template for copying an abstract source object including its children. Since we would
like to pass the copied object to an out-port within the same rule, the approach is to create a dummy object within the rule’s effector and replace it during the AttributeMapping by calling the aforementioned template:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">//++++++++++++++++++++++++++</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">template <class T1, class T2, class T3 > bool UserLibCloneObjectAbstractSource( T1& fromObj, T2& toObj, T3& toParent)</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">{</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> T1 newObj= T1::Create( toParent );</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> UdmUtil::copy_assoc_map copy_map;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> UdmUtil::CopyObjectHierarchy(fromObj.__impl(), newObj.__impl(), newObj.__impl()->__getdn(), copy_map);</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> toObj.DeleteObject();</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> toObj = newObj;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> return true;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">}</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">// ++++++++++++++++++++++++++</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">The result in the transformation’s output is as intended. But, the runtime of the function UdmUtil::CopyObjectHierarchy within the template increases with every
call. After several calls, the execution of UdmUtil::CopyObjectHierarchy takes several seconds. My search within the Udm source code did not reveal any reason. This is why I would like to ask if someone could give me a hint or provide an alternative solution?
For example an incorrect usage of the UdmUtil::copy_assoc_map.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">An example transformation with the necessary metamodel and inputs can be found here:
<a href="https://belschner.org/nextcloud/index.php/s/RiMjSyd2yHKFYdT" target="_blank">
https://belschner.org/nextcloud/index.php/s/RiMjSyd2yHKFYdT</a> PW: GReAT123!</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">The cpp template is located in the “UserLib_CloneObject.h”. The increasing runtime for a single “CopyObjectHierarchy” execution can be seen in the console output
(Steps 2 to 3).</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Thanks in advance and best regards</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="color:#888888"> </span><span style="color:#888888"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="color:#888888">Tim</span><span style="color:#888888"><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
great-users mailing list<br>
<a href="mailto:great-users@list.isis.vanderbilt.edu">great-users@list.isis.vanderbilt.edu</a><br>
<a href="http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/great-users" target="_blank">http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/great-users</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>