38 std::cerr<<
"A fatal error has occurred in function "<<
function<<
" in file "<<file<<
39 std::endl<<
"Error message is:"<<std::endl<<message<<
40 std::endl<<
"Exiting program"<<std::endl;
55 std::cerr<<
"A non-fatal error has occurred in function "<<
function<<
" in file "<<file<<
56 std::endl<<
"Error message is:"<<std::endl<<message<<std::endl;
59 std::cerr<<
"A fatal error has occurred in function "<<
function<<
" in file "<<file<<
60 "\nError message is:\n"<<message<<
"\n";
62 std::cerr <<
"\nExiting program\n";
66 std::cerr<<
"A non-fatal error has occurred in function "<<
function<<
" in file "<<file<<
67 "\nError message is:\n"<<message<<
"\n";
69 std::cerr <<
"\nContinuing program\n";
72 std::cerr<<
"A fatal error has occurred in function "<<
function<<
" in file "<<file<<
73 "\nError message is:\n"<<message<<
"\n";
75 std::cerr <<
"\nExiting program\n";
79 std::cerr<<
"A non-fatal error has occurred in function "<<
function<<
" in file "<<file<<
80 "\nError message is:\n"<<message<<
"\n";
82 std::cerr <<
"\nContinuing program\n";
97 zfft1dx(0, 1.0, 0, (
int)n, 0, 1, 0, 1,
comm, &
info);
100 zfft1dx(0, 1.0, 0, (
int)
len, 0, 1, 0, 1,
comm, &
info);
110 void _fft(
comp* _in,
comp* _out,
const size_t len,
int dir,
double scale){
111 doublecomplex* in = (doublecomplex*)_in;
112 doublecomplex* out = (doublecomplex*)_out;
113 static std::map<size_t, fft_plan_holder> fft_plans;
114 if(in != out && (
size_t)
std::abs((std::ptrdiff_t)(_in - _out)) < len){
115 err(
"Input arrays to fft alias each other, and are not equal",
"fft",
"utils/utils.cpp",
118 if(fft_plans.count(len)==0){
119 fft_plans.insert(std::pair<size_t, fft_plan_holder>(len,
fft_plan_holder(len)));
121 auto& fplan = fft_plans[len];
122 zfft1dx(dir, scale, in==out, (
int)len, in, 1, out, 1, fplan.comm, &(fplan.info));
135 _fft(in, out, len, 1, 1.0);
149 _fft(in, out, len, -1, 1.0/len);
165 size_t startpos = curline.find_first_not_of(val);
166 if(startpos != std::string::npos){
167 curline=curline.substr(startpos);
169 startpos = curline.find_last_not_of(val);
170 if(startpos != std::string::npos){
171 curline=curline.substr(0, startpos+1);
190 size_t tpos = str.find(delim);
191 tok=str.substr(0, tpos);
192 if(tpos == std::string::npos || tpos+delim.length() >= str.size()){
196 str.erase(0, tpos + delim.length());
205 nbase.push_back(
'_');
206 while(
names.count(nbase)){
207 nbase.push_back(1 | (
char)(rand()));
211 nbase.push_back(
'!');