Commits

Matthew Turk committed b7b6c8d

First pass at implementing a constant offset/replacement kernel.

Comments (0)

Files changed (9)

src/enzo/CommunicationMergeStarParticle.C

 #include <map>
 #include <string>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"

src/enzo/DetermineParallelism.C

 #include <math.h>
 
 /* Original includes for Enzo */
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"

src/enzo/ErrorExceptions.h

 #include <stdio.h>
 #include <map>
 #include <string>
+#include <vector>
 #endif
 
 // Example from 

src/enzo/InitializationKernel.h

+/***********************************************************************
+/
+/  KERNELS FOR INITIALIZATION OF DATA
+/
+/  written by: Matthew Turk, Devin Silvia
+/  date:       January 2012
+/
+/  PURPOSE:
+/
+************************************************************************/
+#ifdef NEW_PROBLEM_TYPES
+
+#include <string>
+
+class FieldContainer;
+class InitializationKernel
+{
+    public:
+
+        InitializationKernel() {};
+        virtual void apply(FieldContainer &fields,
+                   FLOAT x, FLOAT y, FLOAT z,
+                   FLOAT dx, FLOAT dy, FLOAT dz) = 0;
+
+};
+
+class InitializationKernelConstant : public InitializationKernel
+{
+    
+    public:
+        InitializationKernelConstant(FieldContainer *constants, int additive);
+        void apply(FieldContainer &fields,
+                   FLOAT x, FLOAT y, FLOAT z,
+                   FLOAT dx, FLOAT dy, FLOAT dz);
+
+    private:
+        FieldContainer *constants;
+        int additive;
+};
+
+#endif

src/enzo/Make.config.objects

 	InexactNewton_InexactNewtonForce.o \
 	InexactNewton_LinesearchStepSize.o \
 	InexactNewton_Solve.o \
+        InitializationKernel.o \
         InitializeCloudyCooling.o \
 	InitializeEquilibriumCoolData.o \
 	InitializeGadgetEquilibriumCoolData.o \

src/enzo/ProblemType.C

     return this->field_values[field_name];
 }
 
+std::map<std::string, float>::iterator FieldContainer::defaults_start()
+{
+    return this->default_values.begin();
+}
+
+std::map<std::string, float>::iterator FieldContainer::defaults_end()
+{
+    return this->default_values.end();
+}
+
 #endif

src/enzo/ProblemType.h

 #ifndef __PROBLEM_TYPES__
 #define __PROBLEM_TYPES__
 
+#include "InitializationKernel.h"
 #include <string>
 
 class FieldContainer
         void add_field(std::string, int FieldNumber, float default_value);
         void reset();
         int needs(std::string field_name);
+        std::map<std::string, float>::iterator defaults_start();
+        std::map<std::string, float>::iterator defaults_end();
     private:
         std::map<std::string, float> field_values;
         std::map<std::string, float> default_values;
     protected:
 
     private:
+
+        std::vector<InitializationKernel> kernels;
 };
 
 /*!

src/enzo/ProblemType_RotatingCylinder.C

 
 #ifdef NEW_PROBLEM_TYPES
 #include <string.h>
+#include <vector>
 #include <stdio.h>
 #include <math.h>
 #include <iostream>

src/enzo/hydro_rk/TurbulenceInitialize.C

 #include <map>
 #include <string>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"