Re: [Paraview] How to insert annotate time info into catalyst?

2018-02-02 Thread Andy Bauer
For Catalyst Live you can use the Python Annotation filter to show the time
after you've extracted the Annotate Time Filter from the Calalyst
simulation run. You'll need to change the Array Association to Row Data and
put in "Text.GetValue(0)" in the Expression.

On Mon, Jan 29, 2018 at 8:59 PM, Seong Mo Yeon 
wrote:

> Hi, Andi Bauer,
>
> I found that annotate time filter works in live visualization and the
> error occurs when output rendering components is activated.
> gdb says the error occurs at vtkSMBoundsDomain.cxx: 60
>   vtkPVDataInformation* info = this->GetInputInformation();
>   if (info)
>   {
> double bounds[6];
> info->GetBounds(bounds);
> this->SetDomainValues(bounds);
>   }
>
> and the vtkPVDataInformation has the following information:
>
> members of vtkPVDataInformation:
>   DataSetType = 19,
>   CompositeDataSetType = -1,
>   NumberOfDataSets = 1,
>   NumberOfPoints = 0,
>   NumberOfCells = 1,
>   NumberOfRows = 1,
>   MemorySize = 1,
>   PolygonCount = 0,
>   Bounds = {1.0001e+299, -1.0001e+299,
> 1.0001e+299, -1.0001e+299, 1.0001e+299,
> -1.0001e+299},
>   Extent = {2147483647 <(214)%20748-3647>, -2147483647 <(214)%20748-3647>,
> 2147483647 <(214)%20748-3647>, -2147483647 <(214)%20748-3647>, 2147483647
> <(214)%20748-3647>, -2147483647 <(214)%20748-3647>},
>   TimeSpan = {-1.0001e+299, 1.0001e+299},
>   Time = 0.0050001,
>   HasTime = 1,
>   NumberOfTimeSteps = 0,
>   DataClassName = 0x5996b050 "vtkTable",
>   TimeLabel = 0x0,
>   CompositeDataClassName = 0x0,
>   CompositeDataSetName = 0x0,
>   PointDataInformation = 0x58ec6430,
>   CellDataInformation = 0x58ec66d0,
>   FieldDataInformation = 0x58ec6770,
>   VertexDataInformation = 0x58ec6890,
>   EdgeDataInformation = 0x58ec67f0,
>   RowDataInformation = 0x58ec6370,
>   CompositeDataInformation = 0x58eb5430,
>   PointArrayInformation = 0x58ec6c50,
>   PortNumber = 0
>
> my guess is that annotate time filter is a type of vtkTable and Bounds
> member variable has too large values. Any idea?
>
> Regards
>
> SeongMo
>
> On 2018년 1월 27일 AM 2:06 +0900, Andy Bauer , wrote:
>
> Hi SeongMo,
>
> The AnnotateTime source should work with Catalyst. See the attached images
> and the annotatetime.py script which I used to create it.
>
> With your script, what do your images look like?
>
> You could also try what Ufuk mentioned. I think his work is based on
> weather/climate time scales so he has to handle months, leap years, etc.
> which ParaView itself doesn't handle naturally. You can see some of the
> things he's done with Catalyst at https://blog.kitware.com/
> integration-of-paraview-catalyst-with-regional-earth-system-model/.
>
> Best,
> Andy
>
> On Thu, Jan 25, 2018 at 10:47 AM, SeongMo  wrote:
>
>> Dear Andy Bauer,
>>
>> For the color map issue, I think ParaView 5.4.1 resolved it. But, I could
>> not figure out annotate time filter issue. may be it is just simple problem
>> but I am not sure. Coprocess routine is as follows and python script is
>> attached.
>>
>> It would be appreciated if you make some advice.
>>
>>
>> void CoProcess(Foam::fvMesh& mesh, Foam::Time& runTime)
>> {
>>vtkNew dataDescription;
>>dataDescription->AddInput("input");
>>const double time = runTime.value();
>>const unsigned int timeStep = runTime.timeIndex();
>>dataDescription->SetTimeData(time, timeStep);
>>
>>if (runTime.end())
>>{
>>// assume that we want to all the pipelines to execute
>>// if it is the last time step
>>dataDescription->ForceOutputOn();
>>}
>>if (Processor->RequestDataDescription(dataDescription.GetPointer())
>> != 0)
>>{
>>Foam::polyMesh::readUpdateState meshState = mesh.readUpdate();
>>
>>if(meshState != Foam::polyMesh::UNCHANGED)
>>{
>>// mesh moved? or mesh topology changed?
>>BuildVTKGrid(mesh, true);
>>}
>>UpdateVTKAttributes(mesh);
>>dataDescription->GetInputDescriptionByName("input")->
>>SetGrid(multiBlockDataSet);
>>Processor->CoProcess(dataDescription.GetPointer());
>>}
>> }
>>
>> Regards.
>>
>> SeongMo
>>
>> SeongMo Yeon, Ph.D, Senior Engineer
>> Offshore Hydrodynamics Research
>> SAMSUNG HEAVY INDUSTRIES CO., LTD.
>> Central Research Institute
>> E-mail : seongmo.y...@gmail.com
>> Tel :
>> 
>> Fluctuat nec mergitur
>>
>> On 01/25/2018 06:56 AM, Andy Bauer wrote:
>>
>> Hi Seongmo,
>>
>> Please keep the conversations on the mailing list so that anyone can
>> follow along or participate. Also, these types of things often get lost in
>> my inbox when they don't make it back to the ParaView mailing list.
>>

Re: [Paraview] How to insert annotate time info into catalyst?

2018-01-25 Thread SeongMo

Dear Andy Bauer,

For the color map issue, I think ParaView 5.4.1 resolved it. But, I 
could not figure out annotate time filter issue. may be it is just 
simple problem but I am not sure. Coprocess routine is as follows and 
python script is attached.


It would be appreciated if you make some advice.


void CoProcess(Foam::fvMesh& mesh, Foam::Time& runTime)
{
   vtkNew dataDescription;
   dataDescription->AddInput("input");
   const double time = runTime.value();
   const unsigned int timeStep = runTime.timeIndex();
   dataDescription->SetTimeData(time, timeStep);

   if (runTime.end())
   {
   // assume that we want to all the pipelines to execute
   // if it is the last time step
   dataDescription->ForceOutputOn();
   }
   if 
(Processor->RequestDataDescription(dataDescription.GetPointer()) != 0)

   {
   Foam::polyMesh::readUpdateState meshState = mesh.readUpdate();

   if(meshState != Foam::polyMesh::UNCHANGED)
   {
   // mesh moved? or mesh topology changed?
   BuildVTKGrid(mesh, true);
   }
   UpdateVTKAttributes(mesh);
dataDescription->GetInputDescriptionByName("input")->
   SetGrid(multiBlockDataSet);
   Processor->CoProcess(dataDescription.GetPointer());
   }
}

Regards.

SeongMo

SeongMo Yeon, Ph.D, Senior Engineer
Offshore Hydrodynamics Research
SAMSUNG HEAVY INDUSTRIES CO., LTD.
Central Research Institute
E-mail : seongmo.y...@gmail.com
Tel :

Fluctuat nec mergitur

On 01/25/2018 06:56 AM, Andy Bauer wrote:

Hi Seongmo,

Please keep the conversations on the mailing list so that anyone can 
follow along or participate. Also, these types of things often get 
lost in my inbox when they don't make it back to the ParaView mailing 
list.


What version of ParaView Catalyst are you using? I think the annotate 
time filter should work with Catalyst but I haven't verified that. I 
vaguely remember others using that filter with Catalyst though. Also, 
I think the colormap bug was fixed. If you have a way of sharing a 
sample that demonstrates either of those bugs I can try taking a look 
at the issue.


Best,
Andy

On Thu, Jan 18, 2018 at 6:40 PM, Seong Mo Yeon > wrote:


Dear Andy Bauer

I have a quick question.
Is it possible to have annotate time filter processed in catalyst
adaptor? Current my code cannot that filter.

BTW, image extracted from catalyst looks different from render
view of paraview at the time of writing a script. e.g., pressure
colormap legend is missing.

Regards
Seongmo

On 2018년 1월 18일 AM 1:17 +0900, Andy Bauer >, wrote:

Hi,

My guess is that the TimeStep isn't getting set properly in the
adaptor (though it looks like it should be in
"dataDescription->SetTimeData(runTime.value(),
runTime.deltaTValue());"). My suggestion would be to add in the
following to either the RequestDataDescription() or
DoCoProcessing() methods in the python script to see what
Catalyst thinks the time step is:
    print("In script2.py, the data time step is ",
datadescription.GetTimeStep())


On Wed, Jan 17, 2018 at 9:57 AM, SeongMo > wrote:

Hi,

I wrote a OpenFOAM adaptor for Catalyst.

In the ParaView, the connection is made good and shows
filtered flow field as written in the python script.

However, filename_%t and image_%t is not expanded as time
marching but just write filename_0 and image_0.png.

As far as I know, %t should be replaced with current time as
given in dataDescription->SetTimeData.

Any help would be appreciated.


FYI, python script is attached and snippet of my OpenFOAM
Adaptor code for Catalyst is as follows:

// icoFoam.C

#ifdef USE_CATALYST
    Foam::HashTable options = args.options();
    IStringStream is(options["scriptList"]);
    wordList scriptList = readList(is);
    OFAdaptor::Initialize(scriptList, mesh);
#endif
    while (runTime.loop())
    {
    runTime.write();
#ifdef USE_CATALYST
    OFAdaptor::CoProcess(mesh, runTime);
#endif
    }
#ifdef USE_CATALYST
    OFAdaptor::Finalize();
#endif


// OFAdaptor.C

void CoProcess(Foam::fvMesh& mesh, Foam::Time& runTime)
{
vtkNew dataDescription;
dataDescription->AddInput("input");
dataDescription->SetTimeData(runTime.value(),
runTime.deltaTValue());
   if (runTime.end())
   {
   // assume that we want to all the pipelines to execute
 

Re: [Paraview] How to insert annotate time info into catalyst?

2018-01-25 Thread Ufuk Utku Turuncoglu (BE)

Hi Seongmo,

I am using following steps to add annotation to Catalyst,

1 - Create a ProgrammableFilter
2 - Add following code to it (don’t forget to modify epoc)

import paraview.simple
import paraview.servermanager
import datetime
import locale

# get output port and copy it to input
out = self.GetOutput()
out.ShallowCopy(self.GetInput())

# define epoc
locale.setlocale(locale.LC_TIME, "en_US")
epoc = datetime.datetime(1949, 12, 1, 0, 0, 0)

# get time value
tval = self.GetInput().GetInformation().Get(out.DATA_TIME_STEP())

# find time by adding hours
#t1 = epoc+datetime.timedelta(seconds=tval)
t1 = epoc+datetime.timedelta(hours=tval)
tstr = t1.strftime(“%d-%b-%Y %H:%M:%S UTC")

# output
label = vtk.vtkStringArray()
label.SetNumberOfComponents(1)
label.Resize(1)
label.SetName("TimeLabel")
label.SetValue(0, t1)
out.GetFieldData().AddArray(label)

3 - Add AnnotateGlobalData1 and select “TimeLabel” as array (needs 
MergeBlocks filter in case of multiblock datasets)


You could modify the section related with generation of time string for 
your needs. I hope it helps.


Regards,

--ufuk

On 25.01.2018 00:56, Andy Bauer wrote:

Hi Seongmo,

Please keep the conversations on the mailing list so that anyone can 
follow along or participate. Also, these types of things often get 
lost in my inbox when they don't make it back to the ParaView mailing 
list.


What version of ParaView Catalyst are you using? I think the annotate 
time filter should work with Catalyst but I haven't verified that. I 
vaguely remember others using that filter with Catalyst though. Also, 
I think the colormap bug was fixed. If you have a way of sharing a 
sample that demonstrates either of those bugs I can try taking a look 
at the issue.


Best,
Andy

On Thu, Jan 18, 2018 at 6:40 PM, Seong Mo Yeon > wrote:


Dear Andy Bauer

I have a quick question.
Is it possible to have annotate time filter processed in catalyst
adaptor? Current my code cannot that filter.

BTW, image extracted from catalyst looks different from render
view of paraview at the time of writing a script. e.g., pressure
colormap legend is missing.

Regards
Seongmo

On 2018년 1월 18일 AM 1:17 +0900, Andy Bauer >, wrote:

Hi,

My guess is that the TimeStep isn't getting set properly in the
adaptor (though it looks like it should be in
"dataDescription->SetTimeData(runTime.value(),
runTime.deltaTValue());"). My suggestion would be to add in the
following to either the RequestDataDescription() or
DoCoProcessing() methods in the python script to see what
Catalyst thinks the time step is:
    print("In script2.py, the data time step is ",
datadescription.GetTimeStep())


On Wed, Jan 17, 2018 at 9:57 AM, SeongMo > wrote:

Hi,

I wrote a OpenFOAM adaptor for Catalyst.

In the ParaView, the connection is made good and shows
filtered flow field as written in the python script.

However, filename_%t and image_%t is not expanded as time
marching but just write filename_0 and image_0.png.

As far as I know, %t should be replaced with current time as
given in dataDescription->SetTimeData.

Any help would be appreciated.


FYI, python script is attached and snippet of my OpenFOAM
Adaptor code for Catalyst is as follows:

// icoFoam.C

#ifdef USE_CATALYST
    Foam::HashTable options = args.options();
    IStringStream is(options["scriptList"]);
    wordList scriptList = readList(is);
    OFAdaptor::Initialize(scriptList, mesh);
#endif
    while (runTime.loop())
    {
    runTime.write();
#ifdef USE_CATALYST
    OFAdaptor::CoProcess(mesh, runTime);
#endif
    }
#ifdef USE_CATALYST
    OFAdaptor::Finalize();
#endif


// OFAdaptor.C

void CoProcess(Foam::fvMesh& mesh, Foam::Time& runTime)
{
vtkNew dataDescription;
dataDescription->AddInput("input");
dataDescription->SetTimeData(runTime.value(),
runTime.deltaTValue());
   if (runTime.end())
   {
   // assume that we want to all the pipelines to execute
   // if it is the last time step
dataDescription->ForceOutputOn();
   }
   if
(Processor->RequestDataDescription(dataDescription.GetPointer())
!= 0)
   {
Foam::polyMesh::readUpdateState meshState = mesh.readUpdate();

   if(meshState != Foam::polyMesh::UNCHANGED)
   {
   BuildVTKGrid(mesh);
   }
   UpdateVTKAttributes(mesh);


Re: [Paraview] How to insert annotate time info into catalyst?

2018-01-24 Thread Andy Bauer
Hi Seongmo,

Please keep the conversations on the mailing list so that anyone can follow
along or participate. Also, these types of things often get lost in my
inbox when they don't make it back to the ParaView mailing list.

What version of ParaView Catalyst are you using? I think the annotate time
filter should work with Catalyst but I haven't verified that. I vaguely
remember others using that filter with Catalyst though. Also, I think the
colormap bug was fixed. If you have a way of sharing a sample that
demonstrates either of those bugs I can try taking a look at the issue.

Best,
Andy

On Thu, Jan 18, 2018 at 6:40 PM, Seong Mo Yeon 
wrote:

> Dear Andy Bauer
>
> I have a quick question.
> Is it possible to have annotate time filter processed in catalyst adaptor?
> Current my code cannot that filter.
>
> BTW, image extracted from catalyst looks different from render view of
> paraview at the time of writing a script. e.g., pressure colormap legend is
> missing.
>
> Regards
> Seongmo
>
> On 2018년 1월 18일 AM 1:17 +0900, Andy Bauer , wrote:
>
> Hi,
>
> My guess is that the TimeStep isn't getting set properly in the adaptor
> (though it looks like it should be in 
> "dataDescription->SetTimeData(runTime.value(),
> runTime.deltaTValue());"). My suggestion would be to add in the following
> to either the RequestDataDescription() or DoCoProcessing() methods in the
> python script to see what Catalyst thinks the time step is:
> print("In script2.py, the data time step is ",
> datadescription.GetTimeStep())
>
>
> On Wed, Jan 17, 2018 at 9:57 AM, SeongMo  wrote:
>
>> Hi,
>>
>> I wrote a OpenFOAM adaptor for Catalyst.
>>
>> In the ParaView, the connection is made good and shows filtered flow
>> field as written in the python script.
>>
>> However, filename_%t and image_%t is not expanded as time marching but
>> just write filename_0 and image_0.png.
>>
>> As far as I know, %t should be replaced with current time as given in
>> dataDescription->SetTimeData.
>>
>> Any help would be appreciated.
>>
>>
>> FYI, python script is attached and snippet of my OpenFOAM Adaptor code
>> for Catalyst is as follows:
>>
>> // icoFoam.C
>>
>> #ifdef USE_CATALYST
>> Foam::HashTable options = args.options();
>> IStringStream is(options["scriptList"]);
>> wordList scriptList = readList(is);
>> OFAdaptor::Initialize(scriptList, mesh);
>> #endif
>> while (runTime.loop())
>> {
>> runTime.write();
>> #ifdef USE_CATALYST
>> OFAdaptor::CoProcess(mesh, runTime);
>> #endif
>> }
>> #ifdef USE_CATALYST
>> OFAdaptor::Finalize();
>> #endif
>>
>>
>> // OFAdaptor.C
>>
>> void CoProcess(Foam::fvMesh& mesh, Foam::Time& runTime)
>> {
>>vtkNew dataDescription;
>>dataDescription->AddInput("input");
>>dataDescription->SetTimeData(runTime.value(),
>> runTime.deltaTValue());
>>if (runTime.end())
>>{
>>// assume that we want to all the pipelines to execute
>>// if it is the last time step
>>dataDescription->ForceOutputOn();
>>}
>>if (Processor->RequestDataDescription(dataDescription.GetPointer())
>> != 0)
>>{
>>Foam::polyMesh::readUpdateState meshState = mesh.readUpdate();
>>
>>if(meshState != Foam::polyMesh::UNCHANGED)
>>{
>>BuildVTKGrid(mesh);
>>}
>>UpdateVTKAttributes(mesh);
>> dataDescription->GetInputDescriptionByName("input")->SetGrid
>> (multiBlockDataSet);
>>Processor->CoProcess(dataDescription.GetPointer());
>>}
>> }
>>
>>
>> --
>> SeongMo Yeon, Ph.D, Senior Engineer
>> Offshore Hydrodynamics Research
>> SAMSUNG HEAVY INDUSTRIES CO., LTD.
>> Central Research Institute
>> E-mail : seongmo.y...@gmail.com
>> Tel :
>> 
>> Fluctuat nec mergitur
>>
>>
>> ___
>> 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:
>> https://paraview.org/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:
https://paraview.org/mailman/listinfo/paraview