15 #include "qdp_map_obj_memory.h"
25 namespace QIOWriteObjCallMapEnv
34 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
36 LatticePropagator
obj;
37 XMLBufferWriter file_xml, record_xml;
43 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
52 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
54 LatticePropagatorF
obj;
55 XMLBufferWriter file_xml, record_xml;
61 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
70 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
72 LatticePropagatorD
obj;
73 XMLBufferWriter file_xml, record_xml;
79 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
90 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
93 XMLBufferWriter file_xml, record_xml;
99 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
109 void QIOWriteLatFermF(
const std::string& buffer_id,
111 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
114 XMLBufferWriter file_xml, record_xml;
120 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
127 void QIOWriteLatFermD(
const std::string& buffer_id,
129 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
132 XMLBufferWriter file_xml, record_xml;
138 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
147 void QIOWriteLatStagProp(
const std::string& buffer_id,
149 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
151 LatticeStaggeredPropagator
obj;
152 XMLBufferWriter file_xml, record_xml;
158 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
165 void QIOWriteLatStagPropF(
const std::string& buffer_id,
167 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
169 LatticeStaggeredPropagatorF
obj;
170 XMLBufferWriter file_xml, record_xml;
176 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
183 void QIOWriteLatStagPropD(
const std::string& buffer_id,
185 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
187 LatticeStaggeredPropagatorD
obj;
188 XMLBufferWriter file_xml, record_xml;
194 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
202 void QIOWriteArrayLatColMat(
const std::string& buffer_id,
204 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
206 multi1d<LatticeColorMatrix>
obj;
207 XMLBufferWriter file_xml, record_xml;
213 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
219 void QIOWriteArrayLatColMatF(
const std::string& buffer_id,
221 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
223 XMLBufferWriter file_xml, record_xml;
225 multi1d<LatticeColorMatrix>&
obj
227 multi1d<LatticeColorMatrixF> u_f(
obj.size());
234 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
235 write(to,record_xml,u_f);
240 void QIOWriteArrayLatColMatD(
const std::string& buffer_id,
242 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
244 XMLBufferWriter file_xml, record_xml;
246 multi1d<LatticeColorMatrix>&
obj
248 multi1d<LatticeColorMatrixD> u_f(
obj.size());
255 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
256 write(to,record_xml,u_f);
263 void QIOWriteQQDiquarkContract(
const std::string& buffer_id,
265 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
267 XMLBufferWriter file_xml, record_xml;
278 const int sz_qq = Ns*Ns*Ns*Ns*Nc*Nc;
279 multi1d<LatticeComplex> obj_1d(sz_qq);
282 multi1d<int> ranks(6);
283 const multi1d<int>& sz =
obj.comp.size();
284 for(ranks[0]=0; ranks[0] < sz[0]; ++ranks[0])
285 for(ranks[1]=0; ranks[1] < sz[1]; ++ranks[1])
286 for(ranks[2]=0; ranks[2] < sz[2]; ++ranks[2])
287 for(ranks[3]=0; ranks[3] < sz[3]; ++ranks[3])
288 for(ranks[4]=0; ranks[4] < sz[4]; ++ranks[4])
289 for(ranks[5]=0; ranks[5] < sz[5]; ++ranks[5])
294 QDPIO::cerr << __func__ <<
": size mismatch for multi1Nd object" << std::endl;
298 obj_1d[cnt++] =
obj.comp[ranks];
302 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
303 write(to,record_xml,obj_1d);
311 void QIOWriteEigenInfo(
const std::string& buffer_id,
313 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
316 XMLBufferWriter file_xml, record_xml;
339 multi1d<Real64> largestD(1);
340 largestD[0] =
obj.getLargest();
343 multi1d<Real> evals =
obj.getEvalues();
346 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
349 XMLBufferWriter largest_record_xml;
350 push(largest_record_xml,
"NumElem");
351 write(largest_record_xml,
"n_vec", evals.size());
352 pop(largest_record_xml);
355 write(to, largest_record_xml, largestD);
358 multi1d<Real64> evalsD(evals.size());
360 for (
int i=0;
i<evals.size();
i++)
361 evalsD[
i] = Real64(evals[
i]);
364 write(to, record_xml, evalsD);
368 multi1d<T>& evecs=
obj.getEvectors();
369 for (
int i=0;
i<evecs.size();
i++)
371 XMLBufferWriter record_xml_dummy;
372 push(record_xml_dummy,
"dummy_record_xml");
373 pop(record_xml_dummy);
376 write(to, record_xml_dummy, evecs[
i]);
385 void QIOWriteRitzPairsLatticeFermion(
const std::string& buffer_id,
387 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
394 XMLBufferWriter file_xml;
395 push(file_xml,
"RitzPairs");
397 write(file_xml,
"Nmax",
obj.evec.size());
402 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
405 for(
int i=0;
i <
obj.Neig; ++
i)
407 XMLBufferWriter record_xml;
408 push(record_xml,
"Eigenstd::vector");
409 write(record_xml,
"eigenNum",
i);
410 write(record_xml,
"eigenValue",
obj.eval.vec[
i]);
421 void QIOWriteSubsetVectors(
const std::string& buffer_id,
423 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
426 QDP::MapObject<int,EVPair<LatticeColorVector> >&
obj =
430 int decay_dir =
Nd-1;
433 XMLBufferWriter file_xml;
435 push(file_xml,
"AllVectors");
436 write(file_xml,
"n_vec",
obj.size());
437 write(file_xml,
"decay_dir", decay_dir);
441 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
444 for(
int n=0;
n <
obj.size();
n++)
447 obj.get(
n, write_pair);
449 XMLBufferWriter record_xml;
450 push(record_xml,
"VectorInfo");
462 template<
typename K,
typename V>
463 void QIOWriteMapObjMemory(
const std::string& buffer_id,
465 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
468 XMLBufferWriter file_xml, record_xml;
471 MapObjectMemory<K,V>&
obj =
479 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
486 for(
typename std::vector<K>::const_iterator mm = keys.begin();
490 XMLBufferWriter local_record_xml;
491 write(local_record_xml,
"MapEntry", *mm);
493 write(to, local_record_xml,
obj[*mm]);
520 QIOWriteLatFerm<LatticeFermion>);
522 QIOWriteLatFerm<LatticeStaggeredFermion>);
530 QIOWriteLatStagProp);
532 QIOWriteLatStagPropF);
534 QIOWriteLatStagPropD);
537 QIOWriteArrayLatColMat);
539 QIOWriteArrayLatColMatF);
541 QIOWriteArrayLatColMatD);
544 QIOWriteQQDiquarkContract);
547 QIOWriteEigenInfo<LatticeFermion>);
550 QIOWriteRitzPairsLatticeFermion);
553 QIOWriteSubsetVectors);
556 QIOWriteMapObjMemory<KeyPropColorVec_t,LatticeFermion>);
Hold eigenvalues and eigenvectors.
Class for counted reference semantics.
Holds eigenvalues and eigenvectors.
Construct a diquark object.
Hold eigenvalues and eigenvectors.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
std::string uniqueId()
Return a unique id.
Class for counted reference semantics.
Handle< MapObject< int, EVPair< LatticeColorVector > > > obj
Key for propagator colorstd::vector sources.
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
Write object function std::map.
SubsetVectorWeight_t eigenValue
Holds of vectors and weights.