LatticeYangMills
outputterm.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * MIT License
4 *
5 * Copyright (c) 2018 Giovanni Pederiva
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 ******************************************************************************/
25 
34 #include <cstdio>
35 #include "InputOutput/outputterm.h"
36 #include "Math/lattice.h"
37 #include "ParallelTools/parallel.h"
38 #include "Observables/observable.h"
39 
40 namespace LatticeIO {
41 
46  if(Parallel::rank() == 0){
47  printf("Total Lattice Size: %2i %2i %2i %2i\n", Parallel::latticeFullSize()[0],Parallel::latticeFullSize()[1],
48  Parallel::latticeFullSize()[2], Parallel::latticeFullSize()[3]);
49  printf("Sublattice Size: %2i %2i %2i %2i\n\n", Parallel::latticeSubSize()[0],Parallel::latticeSubSize()[1],
50  Parallel::latticeSubSize()[2],Parallel::latticeSubSize()[3]);
51  printf("Number of Processors: \t\t%i\n", Parallel::numProcs());
52  printf("Number of Active Processors: \t%i\n\n", Parallel::activeProcs());
53  }
54  }
55 
62  void OutputTerm::printThermStep(int step, std::vector<Observable*>& obsList, double acceptRatio){
63  if(Parallel::rank() == 0){
64  printf("Thermalization Step %4i\n", step);
65  for(auto& obs : obsList)
66  printf("\t%s\t = %lf \n", obs->getName(), obs->value());
67  printf("\tAccept. Ratio = %lf\n", acceptRatio);
68  }
69  }
70 
77  void OutputTerm::printGenStep(int confNum, std::vector<Observable*>& obsList, double acceptRatio){
78  if(Parallel::rank() == 0){
79  printf("Configuration Number %4i\n", confNum);
80  for(auto& obs : obsList)
81  printf("\t%s\t = %lf \n", obs->getName(), obs->value());
82  printf("\tAccept. Ratio = %lf\n", acceptRatio);
83  }
84  }
85 
91  void OutputTerm::writeObs(int confNum, std::vector<Observable*>& obsList){
92  if(Parallel::rank() == 0){
93  printf("Configuration Number %4i\n", confNum);
94  //or(auto& obs : obsList)
95  // printf("\t%s\t = %lf \n", obs->getName(), obs->value());
96  printf("\t%s\t = %g \n", "Plaq.", obsList[0]->plaq);
97  printf("\t%s\t = %g \n", "Topc.", obsList[0]->topc);
98  printf("\t%s\t = %g \n", "Energ.", obsList[0]->energy);
99  }
100 
101  }
102 
108  void OutputTerm::writeFlowObs(double flowTime, std::vector<Observable*>& obsList){
109  if(Parallel::rank() == 0){
110  printf("Flow Time %2.2lf\n", flowTime);
111  //for(auto& obs : obsList)
112  // printf("\t%s\t = %lf \n", obs->getName(), obs->value());
113  printf("\t%s\t = %g \n", "Plaq.", obsList[0]->plaq);
114  printf("\t%s\t = %g \n", "Topc.", obsList[0]->topc);
115  printf("\t%s\t = %g \n", "Energ.", obsList[0]->energy);
116  }
117  }
118 
119 } // end LatticeIO
Contains the definition of the Lattice class.
static void printInitialConditions()
Prints basic info about the system.
Definition: outputterm.cpp:45
Contains the definition of the Observable prototype.
static void printThermStep(int step, std::vector< Observable * > &obsList, double acceptRatio)
Prints information about a thermalization step.
Definition: outputterm.cpp:62
static void writeFlowObs(double flowTime, std::vector< Observable * > &obsList)
Prints information about a flow time evolution step.
Definition: outputterm.cpp:108
Contains classes for output to standard command line interface.
static void printGenStep(int confNum, std::vector< Observable * > &obsList, double acceptRatio)
Prints information about a generation step.
Definition: outputterm.cpp:77
Utilities for parallelization.
static void writeObs(int confNum, std::vector< Observable * > &obsList)
Prints the status of the current object list for a given conf.
Definition: outputterm.cpp:91