Commits

Matthew Turk committed bdcb2c1

Switching interpolation methods to MultiplyByDensity and InterpolateDirectly.

Comments (0)

Files changed (9)

field_objects/FieldDefinitions.h

 };
 
 enum InterpolationType {
-  /* This is not really what we want here, but it will do as a placeholder. */
-  ThirdOrderA,
-  SecondOrderA,
-  SecondOrderB,
-  SecondOrderC,
-  FirstOrderA,
-  InterpolationUndefined
+  MultiplyByDensity,   // This quantity should be multiplied by Density before interpolating
+  InterpolateDirectly, // This quantity should not be multiplied by anything before interpolating
+  Undefined            // Interpolation behavior is undefined
 };
 
 #endif

field_objects/FieldObjects.h

 #include "FieldDefinitions.h"
 #include "FieldExceptions.h"
 #include "FieldDescriptor.h"
+#include "FieldRegistry.h"
 #include "Grid.h"
   long long LeftEdge[MAX_DIMENSIONS] = {0, 0, 0};
   FieldDescriptor *fd = new FieldDescriptor(
     CellCentered, 3, Dimensions, LeftEdge,
-    FirstOrderA, "Density", "g/cc", NULL);
+    InterpolateDirectly, "Density", "g/cc", NULL);
   double *v = fd->GetValues();
   delete fd;
 }

tests/TestCornerCenteredFields.C

 
         this->fds[0] = new FieldDescriptor(
             CornerCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         this->fds[1] = new FieldDescriptor(
             CornerCentered, 3,
-            sdims, sle, FirstOrderA,
+            sdims, sle, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
       }

tests/TestEdgeCenteredFields.C

 
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredX, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredY, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredZ, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredX, 3,
-            sdims, sle, FirstOrderA,
+            sdims, sle, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredY, 3,
-            sdims, sle, FirstOrderA,
+            sdims, sle, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredZ, 3,
-            sdims, sle, FirstOrderA,
+            sdims, sle, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
       }

tests/TestFaceCenteredFields.C

         int fdi = 0;
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredX, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredY, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredZ, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredX, 3,
-            sdims, sle, FirstOrderA,
+            sdims, sle, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredY, 3,
-            sdims, sle, FirstOrderA,
+            sdims, sle, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredZ, 3,
-            sdims, sle, FirstOrderA,
+            sdims, sle, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
       }

tests/TestFieldCenterings.C

         int fdi = 0;
         this->fds[fdi++] = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             CornerCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredX, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredY, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             FaceCenteredZ, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredX, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredY, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
         this->fds[fdi++] = new FieldDescriptor(
             EdgeCenteredZ, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
       }
 

tests/TestFieldDescriptors.C

         long long le[MAX_DIMENSIONS] = {0, 64, 128};
         this->fd = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
       }
 
         le[0] = 4; le[1] = 64; le[2] = 128;
         this->fd1 = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         dims[0] = 32; dims[1] = 16; dims[2] = 64;
         le[0] = 0; le[1] = 56; le[2] = 96;
         this->fd2 = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         vals = this->fd1->GetValues();
         le[0] = 0; le[1] = 0; le[2] = 0;
         this->fd1 = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         dims[0] = 8; dims[1] = 16; dims[2] = 28;
         le[0] = 4; le[1] = 4; le[2] = 2;
         this->fd2 = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         vals = this->fd1->GetValues();
         le[0] = 0; le[1] = 0; le[2] = 0;
         this->fd1 = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         dims[0] = 8; dims[1] = 16; dims[2] = 28;
         le[0] = 128; le[1] = 128; le[2] = 128;
         this->fd2 = new FieldDescriptor(
             CellCentered, 3,
-            dims, le, FirstOrderA,
+            dims, le, InterpolateDirectly,
             "Density", "g/cc", NULL);
 
         vals = this->fd1->GetValues();
   long long LeftEdge[MAX_DIMENSIONS] = {0, 0, 0};
   FieldDescriptor *fd = new FieldDescriptor(
     CellCentered, 3, Dimensions, LeftEdge,
-    FirstOrderA, "Density", "g/cc", NULL);
+    InterpolateDirectly, "Density", "g/cc", NULL);
   double *v = fd->GetValues();
   ASSERT_TRUE(v != NULL);
   // Not sure how to test it is correctly de-allocated.
   pv[0] = NULL;
   FieldDescriptor *fd = new FieldDescriptor(
     CellCentered, 3, Dimensions, LeftEdge,
-    FirstOrderA, "Density", "g/cc", pv);
+    InterpolateDirectly, "Density", "g/cc", pv);
   double *v = fd->GetValues();
   ASSERT_TRUE(v != NULL);
   ASSERT_TRUE(pv[0] != NULL);
   pv[0] = new double[16*16*16];
   FieldDescriptor *fd = new FieldDescriptor(
     CellCentered, 3, Dimensions, LeftEdge,
-    FirstOrderA, "Density", "g/cc", pv);
+    InterpolateDirectly, "Density", "g/cc", pv);
   double *v = fd->GetValues();
   ASSERT_TRUE(v != NULL);
   ASSERT_TRUE(pv[0] != NULL);
   long long LeftEdge[MAX_DIMENSIONS] = {0, 0, 0};
   fd_base = new FieldDescriptor(
       CornerCentered, 3, 
-      Dimensions, LeftEdge, FirstOrderA,
+      Dimensions, LeftEdge, InterpolateDirectly,
       "BaseDensityField", "SomeUnits");
   Dimensions[0] = 8;
   Dimensions[1] = 10;
 }
 
 TEST_F(GridSimpleTest, TestFieldManipulation) {
-  this->g->AddField("Density", "g / cc", 2, FirstOrderA, CellCentered);
-  this->g->AddField("H2I_Density", "g / cc", 2, FirstOrderA, CellCentered);
+  this->g->AddField("Density", "g / cc", 2, InterpolateDirectly, CellCentered);
+  this->g->AddField("H2I_Density", "g / cc", 2, InterpolateDirectly, CellCentered);
 
   FieldDescriptor *rho = g->GetField("Density");
   FieldDescriptor *H2 = g->GetField("H2I_Density");
   long long LeftEdge[MAX_DIMENSIONS] = {0, 0, 0};
   FieldDescriptor *fd1 = new FieldDescriptor(
       CellCentered, 3, Dims, LeftEdge,
-      FirstOrderA, "Density", "g/cc", NULL);
+      InterpolateDirectly, "Density", "g/cc", NULL);
   fd1->CopyFrom(2.0);
   this->g->AttachField("Density", fd1);
   FieldDescriptor *fd2 = this->g->GetField("Density");
 }
 
 TEST_F(GridSimpleTest, TestFieldCreation) {
-  FieldDescriptor *fd = this->g->AddField("Density", "g / cc", 2, FirstOrderA, CellCentered);
+  FieldDescriptor *fd = this->g->AddField("Density", "g / cc", 2, InterpolateDirectly, CellCentered);
   ASSERT_STREQ(fd->GetName(), "Density");
   ASSERT_EQ(fd->GetSize(), 20*20*20);
   long long Position[MAX_DIMENSIONS];
 
 TEST(GridBaryonFieldsTest, TestFieldCreation) {
   Grid *g = new Grid();
-  g->AddField("Something1", "", 0, FirstOrderA, CellCentered);
+  g->AddField("Something1", "", 0, MultiplyByDensity, CellCentered);
   FieldDescriptor *fd = g->GetField("Something1");
   ASSERT_EQ(fd->GetValues(), g->BaryonFields[0]);
   double **v = g->BaryonFields;
 TEST(GridBaryonFieldTest, TestFieldManagement) {
   // This is just a valgrind test
   Grid *g = new Grid();
-  g->AddField("Something1", "", 0, FirstOrderA, CellCentered);
+  g->AddField("Something1", "", 0, MultiplyByDensity, CellCentered);
   double **v = g->BaryonFields;
   delete g;
 }
 TEST(GridBaryonFieldTest, TestAllocateOutFromUnderYou) {
   Grid *g = new Grid();
   double *v;
-  g->AddField("Something1", "", 0, FirstOrderA, CellCentered);
-  g->AddField("Something2", "", 0, FirstOrderA, CellCentered);
+  g->AddField("Something1", "", 0, MultiplyByDensity, CellCentered);
+  g->AddField("Something2", "", 0, MultiplyByDensity, CellCentered);
   delete g->BaryonFields[0];
   g->BaryonFields[0] = NULL;
   ASSERT_TRUE(g->GetField("Something1")->GetValues() == NULL);