I filed a bug for this:
http://www.paraview.org/Bug/view.php?id=11974
The patch is also attached to this mail.

As Mark says it would be very important, so we really hope to see this
included in the upcoming 3.10.1 release.

Thanks!
Takuya

Takuya OSHIMA, Ph.D.
Faculty of Engineering, Niigata University
8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN

From: David Partyka <[email protected]>
Subject: Re: [Paraview] paraview 3.10 + OpenFOAM
Date: Fri, 11 Mar 2011 05:32:05 -0500

> It was released two days ago ;-). Your patch most certainly could be
> included for the next release. If you want, submit a bug on
> paraview.org/Bugwith your patch, and possibly a dataset and
> instructions to recreate the
> original issue.
> 
> Thanks!
> 
> On Fri, Mar 11, 2011 at 3:21 AM, OLESEN Mark <[email protected]>wrote:
> 
>> When is 3.10 slated for release?
>> I have a patch from Takuya OSHIMA for handling a compact face format in
>> OpenFOAM. It would be very important to get this in before the next release.
>> What tests are needed and what is the time-frame to squeezing in this type
>> of change before the 3.10 release?
>>
>> /mark
>>
>>
>> DISCLAIMER:
>> This electronic transmission (and any attachments thereto) is intended
>> solely for the use of the addressee(s). It may contain confidential or
>> legally privileged information. If you are not the intended recipient of
>> this message, you must delete it immediately and notify the sender. Any
>> unauthorized use or disclosure of this message is strictly prohibited.
>> Faurecia does not guarantee the integrity of this transmission and shall
>> therefore never be liable if the message is altered or falsified nor for any
>> virus, interception or damage to your system.
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
diff --git a/IO/vtkOpenFOAMReader.cxx b/IO/vtkOpenFOAMReader.cxx
index e9870cb..7445c6f 100644
--- a/IO/vtkOpenFOAMReader.cxx
+++ b/IO/vtkOpenFOAMReader.cxx
@@ -348,8 +348,6 @@ struct vtkFoamIntVectorVector
 private:
   vtkIntArray *Indices, *Body;
 
-  vtkFoamIntVectorVector();
-
 public:
   ~vtkFoamIntVectorVector()
   {
@@ -363,6 +361,10 @@ public:
     this->Indices->Register(0); // vtkDataArrays do not have ShallowCopy
     this->Body->Register(0);
   }
+  vtkFoamIntVectorVector() :
+    Indices(vtkIntArray::New()), Body(vtkIntArray::New())
+  {
+  }
   vtkFoamIntVectorVector(const int nElements, const int bodyLength) :
     Indices(vtkIntArray::New()), Body(vtkIntArray::New())
   {
@@ -2406,6 +2408,51 @@ public:
       }
   }
 
+  // reads compact list of labels.
+  void ReadCompactIOLabelList(vtkFoamIOobject& io)
+  {
+    if (io.GetFormat() != vtkFoamIOobject::BINARY)
+      {
+      this->ReadLabelListList(io);
+      return;
+      }
+
+    this->Superclass::LabelListListPtr = new vtkFoamIntVectorVector;
+    this->Superclass::Type = LABELLISTLIST;
+    for(int arrayI = 0; arrayI < 2; arrayI++)
+      {
+      vtkFoamToken currToken;
+      if (!io.Read(currToken))
+        {
+        throw vtkFoamError() << "Unexpected EOF";
+        }
+      if (currToken.GetType() == vtkFoamToken::LABEL)
+        {
+        const int sizeI = currToken.To<int>();
+        if (sizeI < 0)
+          {
+          throw vtkFoamError() << "List size must not be negative: size = "
+              << sizeI;
+          }
+        if (sizeI > 0) // avoid invalid reference
+          {
+          vtkIntArray *array = (arrayI == 0
+              ? this->Superclass::LabelListListPtr->GetIndices()
+              : this->Superclass::LabelListListPtr->GetBody());
+          array->SetNumberOfValues(sizeI);
+          io.ReadExpecting('(');
+          io.Read(reinterpret_cast<unsigned char*>(array->GetPointer(0)),
+              sizeI * sizeof(int));
+          io.ReadExpecting(')');
+          }
+        }
+      else
+        {
+        throw vtkFoamError() << "Expected integer, found " << currToken;
+        }
+      }
+  }
+
   bool ReadField(vtkFoamIOobject& io)
   {
     try
@@ -4580,7 +4627,14 @@ vtkFoamIntVectorVector * vtkOpenFOAMReaderPrivate::ReadFacesFile(
   vtkFoamEntryValue dict(NULL);
   try
     {
-    dict.ReadLabelListList(io);
+    if (io.GetClassName() == "faceCompactList")
+      {
+      dict.ReadCompactIOLabelList(io);
+      }
+    else
+      {
+      dict.ReadLabelListList(io);
+      }
     }
   catch(vtkFoamError& e)
     {
_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to