本文整理汇总了C++中ModelType::geometry方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelType::geometry方法的具体用法?C++ ModelType::geometry怎么用?C++ ModelType::geometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelType
的用法示例。
在下文中一共展示了ModelType::geometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: observeOneFullSweep
bool observeOneFullSweep(IoInputType& io,
const ModelType& model,
const PsimagLite::String& list,
bool hasTimeEvolution,
SizeType orbitals)
{
typedef typename ModelType::GeometryType GeometryType;
typedef Observer<VectorWithOffsetType,ModelType,IoInputType> ObserverType;
typedef ObservableLibrary<ObserverType> ObservableLibraryType;
const GeometryType& geometry = model.geometry();
bool verbose = false;
SizeType n = geometry.numberOfSites();
SizeType rows = n; // could be n/2 if there's enough symmetry
SizeType cols = n;
SizeType nf = n - 2;
SizeType trail = 0;
PsimagLite::Vector<PsimagLite::String>::Type vecOptions;
PsimagLite::tokenizer(list,vecOptions,",");
bool hasTrail = false;
for (SizeType i = 0; i < vecOptions.size(); ++i) {
PsimagLite::String item = vecOptions[i];
PsimagLite::String label = "%nf=";
std::size_t labelIndex = item.find(label);
if (labelIndex == 0) {
nf = atoi(item.substr(label.length()).c_str());
rows = nf;
cols = nf;
std::cerr<<"observe: Found "<<label<<" = "<<nf;
std::cerr<<" (rows and cols also set to it)\n";
}
label = "%trail=";
labelIndex = item.find(label);
if (labelIndex == 0) {
trail = atoi(item.substr(label.length()).c_str());
std::cerr<<"observe: Found "<<label<<" = "<<trail<<"\n";
hasTrail = true;
}
label = "%rows=";
labelIndex = item.find(label);
if (labelIndex == 0) {
std::cerr<<"observe: Found %rows= with index "<<labelIndex<<"\n";
rows = atoi(item.substr(label.length()).c_str());
}
label = "%cols=";
labelIndex = item.find(label);
if (labelIndex == 0) {
std::cerr<<"observe: Found %cols= with index "<<labelIndex<<"\n";
cols = atoi(item.substr(label.length()).c_str());
}
}
if (!hasTrail)
trail = n - 2 - nf;
ObservableLibraryType observerLib(io,
n,
hasTimeEvolution,
model,
nf,
trail,
verbose);
for (SizeType i = 0; i < vecOptions.size(); ++i) {
PsimagLite::String item = vecOptions[i];
if (item.find("%") == 0) continue;
if (item.length() > 0 && item[0] != '<')
observerLib.measureTriage(item,rows,cols,orbitals,hasTimeEvolution);
else
observerLib.interpret(item,rows,cols);
}
return observerLib.endOfData();
}