<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
#pfptBannerjhxs69b { all: revert !important; display: block !important;
visibility: visible !important; opacity: 1 !important;
background-color: #D0D8DC !important;
max-width: none !important; max-height: none !important }
.pfptPrimaryButtonjhxs69b:hover, .pfptPrimaryButtonjhxs69b:focus {
background-color: #b4c1c7 !important; }
.pfptPrimaryButtonjhxs69b:active {
background-color: #90a4ae !important; }
</style>
<!-- BaNnErBlUrFlE-HeAdEr-end -->
</head><!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">
On Mon, Apr 1, 2024 at 11: 13 AM MIGUEL MOLINOS PEREZ <mmolinos@ us. es> wrote: Dear Matthew, Thank you for your suggestion. I tried to update the vector with the information coming from the hdf5 file inside the main function. Then I print
</div>
<!-- Preheader Text : END -->
<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerStart</div>
<!--[if ((ie)|(mso))]>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="padding: 16px 0px 16px 0px; direction: ltr" ><tr><td>
<table border="0" cellspacing="0" cellpadding="0" style="padding: 0px 10px 5px 6px; width: 100%; border-radius:4px; border-top:4px solid #90a4ae;background-color:#D0D8DC;"><tr><td valign="top">
<table align="left" border="0" cellspacing="0" cellpadding="0" style="padding: 4px 8px 4px 8px">
<tr><td style="color:#000000; font-family: 'Arial', sans-serif; font-weight:bold; font-size:14px; direction: ltr">
This Message Is From an External Sender
</td></tr>
<tr><td style="color:#000000; font-weight:normal; font-family: 'Arial', sans-serif; font-size:12px; direction: ltr">
This message came from outside your organization.
</td></tr>
</table>
</td></tr></table>
</td></tr></table>
<![endif]-->
<![if !((ie)|(mso))]>
<div dir="ltr" id="pfptBannerjhxs69b" style="all: revert !important; display:block !important; text-align: left !important; margin:16px 0px 16px 0px !important; padding:8px 16px 8px 16px !important; border-radius: 4px !important; min-width: 200px !important; background-color: #D0D8DC !important; background-color: #D0D8DC; border-top: 4px solid #90a4ae !important; border-top: 4px solid #90a4ae;">
<div id="pfptBannerjhxs69b" style="all: unset !important; float:left !important; display:block !important; margin: 0px 0px 1px 0px !important; max-width: 600px !important;">
<div id="pfptBannerjhxs69b" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-weight:bold !important; font-weight:bold; font-size:14px !important; line-height:18px !important; line-height:18px">
This Message Is From an External Sender
</div>
<div id="pfptBannerjhxs69b" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-weight:normal; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size:12px !important; line-height:18px !important; line-height:18px; margin-top:2px !important;">
This message came from outside your organization.
</div>
</div>
<div style="clear: both !important; display: block !important; visibility: hidden !important; line-height: 0 !important; font-size: 0.01px !important; height: 0px"> </div>
</div>
<![endif]>
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerEnd</div>
<!-- Email Banner : END -->
<!-- BaNnErBlUrFlE-BoDy-end -->
<div dir="ltr"><div dir="ltr">On Mon, Apr 1, 2024 at 11:13 AM MIGUEL MOLINOS PEREZ <<a href="mailto:mmolinos@us.es">mmolinos@us.es</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
Dear Matthew,
<div><br>
</div>
<div>Thank you for your suggestion. I tried to update the vector with the information coming from the hdf5 file inside the main function. Then I print the vector two times (see the lines below), the first time it has the correct data. However, the second time,
it has the same values like I never updated it with VecLoad. </div>
<div><br>
</div>
<div>It is an alternative way of initialise a vector coming from DMSWarm with previously stored information (keeping the parallel structure)? </div></div></blockquote><div><br></div><div>Oh, you cannot use the Swarm vectors for VecLoad(). They are just a view into the particle data, and that view is destroyed on restore. Swarm data is stored in a particle-like data structure, not in Vecs. If you want to load this Vec, you have to duplicate exactly as you did. This interface is likely to change in the next year to make this problem go away.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<div>Miguel</div>
<div><br>
</div>
<div>
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;line-height:18px;white-space:pre-wrap">
<div><span style="color:rgb(106,153,85)">//! Load Hdf5 viewer</span></div>
<div><span style="color:rgb(78,201,176)">PetscViewer</span> <span style="color:rgb(156,220,254)">
viewer_hdf5</span>;</div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">PetscViewerHDF5Open</span>(MPI_COMM_WORLD, Output_hdf5_file,</div>
<div>FILE_MODE_READ, &viewer_hdf5));</div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">PetscViewerHDF5PushTimestepping</span>(<span style="color:rgb(156,220,254)">viewer_hdf5</span>));</div>
<br>
<div><span style="color:rgb(106,153,85)">//! Load the vector and fill it with the information from the .hdf5 file</span></div>
<div><span style="color:rgb(78,201,176)">Vec</span> <span style="color:rgb(156,220,254)">
stdv_q</span>;</div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">DMSwarmCreateGlobalVectorFromField</span>(</div>
<div><span style="color:rgb(156,220,254)">Simulation</span>.<span style="color:rgb(156,220,254)">atomistic_data</span>,
<span style="color:rgb(206,145,120)">"stdv-q"</span>, &<span style="color:rgb(156,220,254)">stdv_q</span>));</div>
<br>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">PetscViewerHDF5PushGroup</span>(<span style="color:rgb(156,220,254)">viewer_hdf5</span>,
<span style="color:rgb(206,145,120)">"/particle_fields"</span>));</div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">VecLoad</span>(<span style="color:rgb(156,220,254)">stdv_q</span>,
<span style="color:rgb(156,220,254)">viewer_hdf5</span>));</div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">VecView</span>(stdv_q,
<span style="color:rgb(86,156,214)">PETSC_VIEWER_STDOUT_WORLD</span>));</div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">PetscViewerHDF5PopGroup</span>(<span style="color:rgb(156,220,254)">viewer_hdf5</span>));</div>
<br>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">DMSwarmDestroyGlobalVectorFromField</span>(</div>
<div><span style="color:rgb(156,220,254)">Simulation</span>.<span style="color:rgb(156,220,254)">atomistic_data</span>,
<span style="color:rgb(206,145,120)">"stdv-q"</span>, &<span style="color:rgb(156,220,254)">stdv_q</span>));</div>
<br>
<div><span style="color:rgb(106,153,85)">//! Destoy HDF5 context</span></div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">PetscViewerDestroy</span>(&<span style="color:rgb(156,220,254)">viewer_hdf5</span>));</div>
<br>
<div><span style="color:rgb(106,153,85)">//! Load the vector again and print</span></div>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">DMSwarmCreateGlobalVectorFromField</span>(</div>
<div><span style="color:rgb(156,220,254)">Simulation</span>.<span style="color:rgb(156,220,254)">atomistic_data</span>,
<span style="color:rgb(206,145,120)">"stdv-q"</span>, &<span style="color:rgb(156,220,254)">stdv_q</span>));</div>
<br>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">VecView</span>(stdv_q,
<span style="color:rgb(86,156,214)">PETSC_VIEWER_STDOUT_WORLD</span>));</div>
<br>
<div><span style="color:rgb(86,156,214)">REQUIRE_NOTHROW</span>(<span style="color:rgb(220,220,170)">DMSwarmDestroyGlobalVectorFromField</span>(</div>
<div><span style="color:rgb(156,220,254)">Simulation</span>.<span style="color:rgb(156,220,254)">atomistic_data</span>,
<span style="color:rgb(206,145,120)">"stdv-q"</span>, &<span style="color:rgb(156,220,254)">stdv_q</span>));</div>
</div>
</div>
<div><br>
</div>
<div>Best,</div>
<div>Miguel</div>
<div><br id="m_-5709158563722898845lineBreakAtBeginningOfMessage">
<div>
<div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">
Miguel Molinos<br>
Investigador postdoctoral <br>
Juan de la Cierva<br>
Dpto. Mecánica de Medios Continuos y Teoría de Estructuras - ETSI<br>
Universidad de Sevilla<br>
Camino de los descubrimientos, s/n<br>
41092 Sevilla</div>
<div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">
<br>
</div>
<br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">
<span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"></span><span><img alt="us_logo.jpg" src="cid:ii_18e9a7de4d347b1319f1"></span>
<div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">
<br>
<br>
<br>
<br>
<a href="https://urldefense.us/v3/__http://www.us.es__;!!G_uCfscf7eWS!YcVqv_PA_UdFsx4fZHfzMMaZZ7auMp-poE49ThdEDk0fT7DAXF6-0fOpeWMEOJcrVL5grSHp-QCF8PdvRl51$" target="_blank">www.us.es</a><br>
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Si no es UD. el destinatario del mensaje, le ruego lo destruya sin hacer copia
digital o física, comunicando al emisor por esta misma vía la recepción del presente mensaje. Gracias</div>
<div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">
<br>
</div>
<br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">
<br style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
</div>
<div><br>
<blockquote type="cite">
<div>On 1 Apr 2024, at 16:28, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div>
<br>
<div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
>From the description, my guess is that this is pointer confusion. The vector inside the function is different from the vector outside the function.</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YcVqv_PA_UdFsx4fZHfzMMaZZ7auMp-poE49ThdEDk0fT7DAXF6-0fOpeWMEOJcrVL5grSHp-QCF8AYgu-dB$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>