[Paraview] not all fields written by allinputsgridwriter.py ...
Ufuk Utku Turuncoglu (BE)
u.utku.turuncoglu at be.itu.edu.tr
Tue Dec 13 02:41:56 EST 2016
Hi Andy,
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.
Regards,
--ufuk
On 12/12/2016 17:57, Andy Bauer wrote:
> 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?
>
> On Mon, Dec 12, 2016 at 7:22 AM, Ufuk Utku Turuncoglu (BE)
> <u.utku.turuncoglu at be.itu.edu.tr
> <mailto:u.utku.turuncoglu at be.itu.edu.tr>> wrote:
>
> Hi Andy,
>
> 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
>
> int i = dataSet->GetPointData()->AddArray(field);
>
> 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()->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
>
> template<GridType gridType>
> void Grid<gridType>::SetAttributeValue(vtkCPDataDescription*
> coprocessorData, double* data, const char* vname, const char*
> pname, int* size, int* mpiSize, int* mpiRank) {
> //
> // Get grid
> //
> vtkCPInputDataDescription* idd =
> coprocessorData->GetInputDescriptionByName(pname);
> vtkMultiBlockDataSet *grid =
> vtkMultiBlockDataSet::SafeDownCast(idd->GetGrid());
> if (!grid) {
> vtkGenericWarningMacro("No adaptor grid to attach field data
> to.");
> return;
> }
>
> //
> // Create dataset and fill with input data
> //
> vtkMultiPieceDataSet *multiPiece =
> vtkMultiPieceDataSet::SafeDownCast(grid->GetBlock(0));
> vtkDataSet *dataSet =
> vtkDataSet::SafeDownCast(multiPiece->GetPiece(*mpiRank));
>
> if (idd->IsFieldNeeded(vname)) {
> //std::cout << "update variable " << vname << " " <<
> coprocessorData->GetTime() << std::endl;
> vtkSmartPointer<vtkDoubleArray> field =
> vtkSmartPointer<vtkDoubleArray>::New();
> field->SetName(vname);
> field->SetNumberOfComponents(1);
>
> //field->SetArray(data, *size, 1);
> field->SetNumberOfValues(*size);
> for (int i = 0; i < *size; i++) {
> field->SetValue(i, data[i]);
> }
>
> int i = dataSet->GetPointData()->AddArray(field);
> std::cout << *mpiRank << " " << vname << " " << i << " " <<
> dataSet->GetPointData()->GetNumberOfArrays() << std::endl;
> }
> }
>
> --ufuk
>
>
> On 09/12/2016 23:50, u.utku.turuncoglu at be.itu.edu.tr
> <mailto:u.utku.turuncoglu at be.itu.edu.tr> wrote:
>> 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
>>
>>> 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) <
>>> u.utku.turuncoglu at be.itu.edu.tr
>>> <mailto:u.utku.turuncoglu at be.itu.edu.tr>> wrote:
>>>
>>>> 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
>>>> _______________________________________________
>>>> Powered bywww.kitware.com <http://www.kitware.com>
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensou
>>>> rce/opensource.html
>>>>
>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>> http://paraview.org/Wiki/ParaView
>>>> <http://paraview.org/Wiki/ParaView>
>>>>
>>>> Search the list archives at:http://markmail.org/search/?q=ParaView
>>>> <http://markmail.org/search/?q=ParaView>
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/paraview
>>>> <http://public.kitware.com/mailman/listinfo/paraview>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161213/ea618e9c/attachment.html>
More information about the ParaView
mailing list