<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Andy,<br>
<br>
Thanks for the clue. Actually, the code was creating the
underlying grid multiple times with the same name. It basically
overwrites the grid every time step and then i think that adaptor
code lost the reference for the grid (even if it is the same name)
and assumes that it is a new one and shows the single field that
is attached to it. Anyway, there was a bug in the piece of model
code that controls the grid is defined or not? So, i fixed it now
and i could see the all the variables as expected. Thanks for your
great help. Sometimes, i could lost in the code :) and it makes
hard to debug. Anyway, thanks again.<br>
<br>
Regards,<br>
<br>
--ufuk <br>
<br>
On 12/12/2016 17:57, Andy Bauer wrote:<br>
</div>
<blockquote
cite="mid:CAMaOp+GbBcUOmLtDsTJ301dvv348Fw_W270BGWUVTSe=X8pDjA@mail.gmail.com"
type="cite">
<div dir="ltr">Any chance that you have a different grid that
you're adding the field to? What happens if you print out the
number of point data arrays before you add the grid?<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Dec 12, 2016 at 7:22 AM, Ufuk
Utku Turuncoglu (BE) <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:u.utku.turuncoglu@be.itu.edu.tr"
target="_blank">u.utku.turuncoglu@be.itu.edu.tr</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="m_947718220235035280moz-cite-prefix">Hi Andy,<br>
<br>
I tested code with different variable names but the
result is same. I also tried to get index of added array
by using following call<br>
<br>
int i = dataSet->GetPointData()-><wbr>AddArray(field);<br>
<br>
but the returned value "i" is always zero for all the
variables. I think that this affects the number of
fields that are written to the file. By the way, i print
out the value of dataSet->GetPointData()-><wbr>GetNumberOfArrays()
and it returns always 1. So, somehow i am missing
something but i could not find. The part of the code
that is responsible to add array is<br>
<br>
template<GridType gridType> <br>
void Grid<gridType>::<wbr>SetAttributeValue(<wbr>vtkCPDataDescription*
coprocessorData, double* data, const char* vname, const
char* pname, int* size, int* mpiSize, int* mpiRank) {<br>
// <br>
// Get grid<br>
// <br>
vtkCPInputDataDescription* idd =
coprocessorData-><wbr>GetInputDescriptionByName(<wbr>pname);<br>
vtkMultiBlockDataSet *grid = vtkMultiBlockDataSet::<wbr>SafeDownCast(idd->GetGrid());<br>
if (!grid) {<br>
vtkGenericWarningMacro("No adaptor grid to attach
field data to.");<br>
return;<br>
}<br>
<br>
//<br>
// Create dataset and fill with input data<br>
//<br>
vtkMultiPieceDataSet *multiPiece =
vtkMultiPieceDataSet::<wbr>SafeDownCast(grid->GetBlock(0)<wbr>);<br>
vtkDataSet *dataSet = vtkDataSet::SafeDownCast(<wbr>multiPiece->GetPiece(*mpiRank)<wbr>);<br>
<br>
if (idd->IsFieldNeeded(vname)) {<br>
//std::cout << "update variable " <<
vname << " " <<
coprocessorData->GetTime() << std::endl;<br>
vtkSmartPointer<<wbr>vtkDoubleArray> field =
vtkSmartPointer<<wbr>vtkDoubleArray>::New();<br>
field->SetName(vname);<br>
field->SetNumberOfComponents(<wbr>1);<br>
<br>
//field->SetArray(data, *size, 1);<br>
field->SetNumberOfValues(*<wbr>size);<br>
for (int i = 0; i < *size; i++) {<br>
field->SetValue(i, data[i]);<br>
}<br>
<br>
int i = dataSet->GetPointData()-><wbr>AddArray(field);<br>
std::cout << *mpiRank << " " <<
vname << " " << i << " " <<
dataSet->GetPointData()-><wbr>GetNumberOfArrays()
<< std::endl;<br>
}<br>
}<span class="HOEnZb"><font color="#888888"><br>
<br>
--ufuk</font></span>
<div>
<div class="h5"><br>
<br>
On 09/12/2016 23:50, <a moz-do-not-send="true"
class="m_947718220235035280moz-txt-link-abbreviated"
href="mailto:u.utku.turuncoglu@be.itu.edu.tr"
target="_blank">u.utku.turuncoglu@be.itu.edu.<wbr>tr</a>
wrote:<br>
</div>
</div>
</div>
<div>
<div class="h5">
<blockquote type="cite">
<pre>Thanks for your help Andy. No. Their names are "tsfc" and "psfc". In this
case, I have only one input port and two fields. I could also try to test
with different fields but I could do it on Monday when I have access to
server.
Regards,
--ufuk
</pre>
<blockquote type="cite">
<pre>Are the fields uniquely named? That would be my first guess. Other than
that, what are the names of the fields? Some names are specially handled
in
which case they may be hidden in the ParaView GUI.
On Fri, Dec 9, 2016 at 8:23 AM, Ufuk Utku Turuncoglu (BE) <
<a moz-do-not-send="true" class="m_947718220235035280moz-txt-link-abbreviated" href="mailto:u.utku.turuncoglu@be.itu.edu.tr" target="_blank">u.utku.turuncoglu@be.itu.edu.<wbr>tr</a>> wrote:
</pre>
<blockquote type="cite">
<pre>Hi,
I am using allinputsgridwriter.py to write data that are coming from
co-processing. The problem is that the result file does not contain all
the
fields. The adaptor code sends two fields but the written file has only
single field (the first one). The same adaptor code and
allinputsgridwriter.py script generate desired output with an other
model
code. So, i think that the adaptor and allinputsgridwriter.py are fine.
There must be a problem in the model code but i could not find it. At
this
point, i just wonder which part of code could cause the problem. Can you
suggest me any particular key point that i need to focus?
Thanks,
--ufuk
______________________________<wbr>_________________
Powered by <a moz-do-not-send="true" class="m_947718220235035280moz-txt-link-abbreviated" href="http://www.kitware.com" target="_blank">www.kitware.com</a>
Visit other Kitware open-source projects at
<a moz-do-not-send="true" class="m_947718220235035280moz-txt-link-freetext" href="http://www.kitware.com/opensou" target="_blank">http://www.kitware.com/opensou</a>
rce/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
<a moz-do-not-send="true" class="m_947718220235035280moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/<wbr>ParaView</a>
Search the list archives at: <a moz-do-not-send="true" class="m_947718220235035280moz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a>
Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" class="m_947718220235035280moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview</a>
</pre>
</blockquote>
</blockquote>
</blockquote>
<p>
</p>
</div></div></div>
</blockquote></div>
</div>
</blockquote><p>
</p></body></html>