Commits

Matthew Turk committed 8920ea0

Adding GetFieldDimensions, which is not the same as GetDimensions.

Comments (0)

Files changed (3)

field_objects/FieldDescriptor.C

   }
 }
 
+int FieldDescriptor::GetFieldDimensions(int Dimensions[MAX_DIMENSIONS]) {
+  int dim;
+  switch (this->ValueCentering) {
+    case CellCentered:
+      for (dim = 0; dim < this->Rank; dim++) {
+        Dimensions[dim] = this->Dimensions[dim];
+      }
+      break;
+    case VertexCentered:
+      for (dim = 0; dim < this->Rank; dim++) {
+        Dimensions[dim] = this->Dimensions[dim] + 1;
+      }
+      break;
+    case FaceCentered:
+      for (dim = 0; dim < this->Rank; dim++) {
+        Dimensions[dim] = this->Dimensions[dim] + 2; // INCORRECT
+      }
+    default:
+      break;
+  }
+}
+
 void FieldDescriptor::GetLeftEdge(long long LeftEdge[MAX_DIMENSIONS]) {
     int dim;
     for (dim = 0; dim < this->Rank; dim++) {
       int dim;
       this->GetLeftEdge(GlobalLeftEdgeThis);
       Other->GetLeftEdge(GlobalLeftEdgeOther);
-      Other->GetDimensions(OtherDims);
+      Other->GetFieldDimensions(OtherDims);
       for (dim = 0; dim < this->Rank; dim++) {
         OverlapStart = MAX(GlobalLeftEdgeThis[dim], GlobalLeftEdgeOther[dim]);
         OverlapEnd = MIN(GlobalLeftEdgeThis[dim] + this->Dimensions[dim],

field_objects/FieldDescriptor.h

       double *GetValues();
       int GetSize();
       int GetDimensions(int Dimensions[MAX_DIMENSIONS]);
+      int GetFieldDimensions(int Dimensions[MAX_DIMENSIONS]);
       void GetLeftEdge(long long LeftEdge[MAX_DIMENSIONS]);
 
       void GetOverlapRegion(FieldDescriptor *Other,

tests/TestFieldCenterings.C

   ASSERT_THROW(this->fd_face->Divide(this->fd_vert), FieldsIncompatible);
   ASSERT_NO_THROW(this->fd_face->Divide(this->fd_face));
 }
-
-