Commits

Matthew Turk committed 45d6293 Merge

Merge

  • Participants
  • Parent commits c94f50f, a66dae4

Comments (0)

Files changed (1)

src/enzo/ProblemType_RotatingCylinder.C

         DataUnits[j] = NULL;
 
       /* Write parameters to parameter output file */
-
       if (MyProcessorNumber == ROOT_PROCESSOR) {
-        fprintf(Outfptr, "RotatingCylinderOverdensity         = %"FSYM"\n"  , RotatingCylinderOverdensity);
-        fprintf(Outfptr, "RotatingCylinderLambda         = %"FSYM"\n"  , RotatingCylinderLambda);
-        fprintf(Outfptr, "RotatingCylinderTotalEnergy         = %"FSYM"\n"  , RotatingCylinderTotalEnergy);
-        fprintf(Outfptr, "RotatingCylinderRadius         = %"PSYM"\n"  , RotatingCylinderRadius);
-        fprintf(Outfptr, "RotatingCylinderCenterPosition = %"PSYM" %"PSYM" %"PSYM"\n",
-            RotatingCylinderCenterPosition, RotatingCylinderCenterPosition+1,
-            RotatingCylinderCenterPosition+2);
-        fprintf(Outfptr, "TestProblemUseMetallicityField  = %"ISYM"\n", TestProblemData.UseMetallicityField);
-        fprintf(Outfptr, "TestProblemInitialMetallicityFraction  = %"FSYM"\n", TestProblemData.MetallicityField_Fraction);
-
+        WriteConfig(Outfptr);
       } //   if (MyProcessorNumber == ROOT_PROCESSOR) 
 
-
       if(debug){
         printf("Exiting RotatingCylinderInitialize\n");
         fflush(stdout);
     void ReadConfig(FILE *fptr)
     {
         /* read input from file */
-      char line[MAX_LINE_LENGTH];
-      int ret;
-      while (fgets(line, MAX_LINE_LENGTH, fptr) != NULL) {
-          ret = 0;
+        char line[MAX_LINE_LENGTH];
+        int ret;
+        while (fgets(line, MAX_LINE_LENGTH, fptr) != NULL) {
+            ret = 0;
 
-          /* read parameters specifically for RotatingCylinder problem*/
-          ret += sscanf(line, "RotatingCylinderOverdensity  = %"FSYM, this->RotatingCylinderOverdensity);
-          ret += sscanf(line, "RotatingCylinderSubgridLeft = %"PSYM,
-              this->RotatingCylinderSubgridLeft);
-          ret += sscanf(line, "RotatingCylinderSubgridRight = %"PSYM,
-              this->RotatingCylinderSubgridRight);
-          ret += sscanf(line, "RotatingCylinderLambda = %"FSYM,
-              this->RotatingCylinderLambda);
-          ret += sscanf(line, "RotatingCylinderTotalEnergy = %"FSYM,
-              this->RotatingCylinderTotalEnergy);
-          ret += sscanf(line, "RotatingCylinderRadius = %"PSYM,
-              this->RotatingCylinderRadius);
-          ret += sscanf(line, "RotatingCylinderCenterPosition = %"PSYM" %"PSYM" %"PSYM,
-            this->RotatingCylinderCenterPosition, (this->RotatingCylinderCenterPosition)+1,
-            (this->RotatingCylinderCenterPosition)+2);
+            /* read parameters specifically for RotatingCylinder problem*/
+            ret += sscanf(line, "RotatingCylinderOverdensity  = %"FSYM, this->RotatingCylinderOverdensity);
+            ret += sscanf(line, "RotatingCylinderSubgridLeft = %"PSYM,
+                this->RotatingCylinderSubgridLeft);
+            ret += sscanf(line, "RotatingCylinderSubgridRight = %"PSYM,
+                this->RotatingCylinderSubgridRight);
+            ret += sscanf(line, "RotatingCylinderLambda = %"FSYM,
+                this->RotatingCylinderLambda);
+            ret += sscanf(line, "RotatingCylinderTotalEnergy = %"FSYM,
+                this->RotatingCylinderTotalEnergy);
+            ret += sscanf(line, "RotatingCylinderRadius = %"PSYM,
+                this->RotatingCylinderRadius);
+            ret += sscanf(line, "RotatingCylinderCenterPosition = %"PSYM" %"PSYM" %"PSYM,
+                this->RotatingCylinderCenterPosition, (this->RotatingCylinderCenterPosition)+1,
+                (this->RotatingCylinderCenterPosition)+2);
 
-          ret += sscanf(line, "TestProblemUseMetallicityField  = %"ISYM, TestProblemData.UseMetallicityField);
-          ret += sscanf(line, "TestProblemInitialMetallicityFraction  = %"FSYM, TestProblemData.MetallicityField_Fraction);
+            ret += sscanf(line, "TestProblemUseMetallicityField  = %"ISYM, TestProblemData.UseMetallicityField);
+            ret += sscanf(line, "TestProblemInitialMetallicityFraction  = %"FSYM, TestProblemData.MetallicityField_Fraction);
 
-          /* if the line is suspicious, issue a warning */
+            /* if the line is suspicious, issue a warning */
 
-          if (ret == 0 && strstr(line, "=") && (strstr(line, "RotatingCylinder") || strstr(line, "TestProblem")) &&
-              line[0] != '#' && MyProcessorNumber == ROOT_PROCESSOR)
-            fprintf(stderr,
-                "*** warning: the following parameter line was not interpreted:\n%s\n", line);
+            if (ret == 0 && strstr(line, "=") && (strstr(line, "RotatingCylinder") || strstr(line, "TestProblem")) &&
+                line[0] != '#' && MyProcessorNumber == ROOT_PROCESSOR)
+                fprintf(stderr,
+                    "*** warning: the following parameter line was not interpreted:\n%s\n", line);
 
-    } // end input from parameter file
-  }  
+        } // end input from parameter file
+    }
+
+    void WriteConfig(FILE *Outfptr)
+    {
+        fprintf(Outfptr, "RotatingCylinderOverdensity         = %"FSYM"\n"  , this->RotatingCylinderOverdensity);
+        fprintf(Outfptr, "RotatingCylinderLambda         = %"FSYM"\n"  , this->RotatingCylinderLambda);
+        fprintf(Outfptr, "RotatingCylinderTotalEnergy         = %"FSYM"\n"  , this->RotatingCylinderTotalEnergy);
+        fprintf(Outfptr, "RotatingCylinderRadius         = %"PSYM"\n"  , this->RotatingCylinderRadius);
+        fprintf(Outfptr, "RotatingCylinderCenterPosition = %"PSYM" %"PSYM" %"PSYM"\n",
+                this->RotatingCylinderCenterPosition, (this->RotatingCylinderCenterPosition)+1,
+                (this->RotatingCylinderCenterPosition)+2);
+        fprintf(Outfptr, "TestProblemUseMetallicityField  = %"ISYM"\n", this->TestProblemData.UseMetallicityField);
+        fprintf(Outfptr, "TestProblemInitialMetallicityFraction  = %"FSYM"\n", this->TestProblemData.MetallicityField_Fraction);
+    }
 
 };