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, [email protected] 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) <
[email protected]> 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

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

Search the list archives at:http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to