23 namespace InlineMILCWriteStagSourceEnv
46 success &= TheInlineMeasurementFactory::Instance().registerObject(
name, createMeasurement);
71 write(xml,
"Frequency",
p.frequency);
73 write(xml,
"OutputFile",
p.output_file_name);
74 write(xml,
"OutputVolfmt",
p.qio_volfmt);
75 bool parallel_io_choice =
false;
76 if(
p.parallel_io == QDPIO_PARALLEL) {
77 parallel_io_choice =
true;
79 write(xml,
"parallel_io", parallel_io_choice);
80 write(xml,
"Precision",
p.precision);
84 push(xml,
"NamedObject");
85 write(xml,
"source_id",
p.source_id);
86 write(xml,
"t_slice",
p.t_slice);
89 if (
p.xml_file !=
"") {
90 write(xml,
"xml_file",
p.xml_file);
96 InlineMILCWriteStagSourceParams::InlineMILCWriteStagSourceParams() { frequency = 0; xml_file=
""; }
98 InlineMILCWriteStagSourceParams::InlineMILCWriteStagSourceParams(XMLReader& xml_in,
const std::string& path)
102 XMLReader paramtop(xml_in, path);
104 if (paramtop.count(
"Frequency") == 1)
105 read(paramtop,
"Frequency", frequency);
110 read(paramtop,
"Param/OutputFile", output_file_name);
111 read(paramtop,
"Param/OutputVolfmt", qio_volfmt);
112 bool parallel_io_choice = Layout::isIOGridDefined() && ( Layout::numIONodeGrid() > 1);
114 if( paramtop.count(
"Param/parallel_io") == 1) {
115 read(paramtop,
"Param/parallel_io", parallel_io_choice);
120 if( parallel_io_choice ) {
121 parallel_io = QDPIO_PARALLEL;
124 parallel_io = QDPIO_SERIAL;
126 read(paramtop,
"Param/Precision", precision);
129 read(paramtop,
"./NamedObject/source_id", source_id);
131 if( paramtop.count(
"xml_file") == 1 ) {
132 read(paramtop,
"./xml_file", xml_file);
140 QDPIO::cerr << __func__ <<
": caught Exception reading XML: " << e << std::endl;
153 if(
params.xml_file ==
"" ) {
154 func(update_no, xml_out);
157 XMLFileWriter separate_output(
params.xml_file);
158 func(update_no, separate_output);
169 QDPIO::cerr<<
" code only works for Nc=3 \n";
175 push(xml_out,
"MILCWriteStaggSource");
176 write(xml_out,
"update_no", update_no);
182 QDPIO::cout <<
"Attempt to write object name = " <<
params.source_id << std::endl;
183 QDPIO::cout <<
"On timeslice: " <<
params.t_slice << std::endl;
184 QDPIO::cout <<
"Output file = " <<
params.output_file_name << std::endl;
196 LatticeStaggeredPropagator& trial_source=TheNamedObjMap::Instance().getData<LatticeStaggeredPropagator>(
params.source_id);
199 QDPIO::cout <<
"Could not get the source from the named ObjectMap. Missing ID"<<
params.source_id << std::endl;
205 const LatticeStaggeredPropagator& theSrc=
206 TheNamedObjMap::Instance().getData<LatticeStaggeredPropagator>(
params.source_id);
209 XMLBufferWriter file_xml;
210 push(file_xml,
"ChromaMILCStaggeredSource");
211 write(file_xml,
"note",
"Staggered Source written from Chroma. Metadata irrelevant");
215 QDPFileWriter qio_out(file_xml,
params.output_file_name,
221 multi1d<int> lower_left(
Nd);
222 multi1d<int> upper_right(
Nd);
224 for(
int i=0;
i <
Nd-1; ++
i) {
226 upper_right[
i] = Layout::lattSize()[
i]-1;
231 for(
int col=0; col < 3; ++col) {
232 XMLBufferWriter record_xml;
233 push(record_xml,
"usqcdKSPropInfo");
234 write(record_xml,
"version",
"1.0");
235 write(record_xml,
"color", col);
236 write(record_xml,
"info",
" ");
240 LatticeStaggeredFermion tmpFerm;
244 if (
params.precision ==
"single" ) {
245 LatticeStaggeredFermionF castFerm=(tmpFerm) ;
246 LatticeColorVectorF fermOut;
250 QDPIO::cout <<
"About to write single prec. source component: " << col << std::endl;
251 QDPIO::cout <<
"TypeSize is: " <<
sizeof(PColorVector<RComplex<REAL32>,3>) << std::endl;
252 write(qio_out,record_xml, fermOut, lower_left, upper_right);
256 LatticeStaggeredFermionD castFerm(tmpFerm);
257 LatticeColorVector fermOut;
261 QDPIO::cout <<
"About to write double prec. source component." << col << std::endl;
262 write(qio_out,record_xml,fermOut, lower_left, upper_right);
Inline measurement factory.
Primary include file for CHROMA library code.
void FermToCv(const LatticeStaggeredFermionD &a, LatticeColorVectorD &b)
Convert a LatticeStaggeredFermion into a LatticeColorVector (extract)
void PropToFerm(const LatticePropagatorF &b, LatticeFermionF &a, int color_index, int spin_index)
Extract a LatticeFermion from a LatticePropagator.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
Class for counted reference semantics.
Inline task to read a USQCD DD Pairs Prop.
Named object function std::map.
static bool registered
Local registration flag.
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
void write(XMLWriter &xml, const std::string &path, const InlineMILCWriteStagSourceParams &p)
Object buffer.
push(xml_out,"Cooled_Topology")