77 if (
m_f->m_exp[0]->GetNumElmts() == 0)
82 string fromfld =
m_config[
"fromfld"].as<
string>();
86 "The config parameter "
87 "fromfld needs to be defined");
91 for (
int i = 0; i <
m_f->m_exp[0]->GetExpSize(); ++i)
93 ElementGIDs[i] =
m_f->m_exp[0]->GetExp(i)->GetGeom()->GetGlobalID();
96 int nfields =
m_f->m_variables.size();
97 int nphys =
m_f->m_exp[0]->GetTotPoints();
99 string fields =
m_config[
"fields"].as<
string>();
100 vector<unsigned int> processFields;
101 string multifldidsstr =
m_config[
"multifldids"].as<
string>();
102 vector<unsigned int> multiFldIds;
103 vector<string> fromfiles;
104 bool allfromflds =
m_config[
"allfromflds"].as<
bool>();
106 if (fields.compare(
"All") == 0)
108 for (
int i = 0; i < nfields; ++i)
110 processFields.push_back(i);
116 "Failed to interpret field string in module innerproduct");
119 if (multifldidsstr.compare(
"NotSet") == 0)
121 fromfiles.push_back(fromfld);
127 "Failed to interpret multifldids string in module innerproduct");
128 int end = fromfld.find_first_of(
'.', 0);
129 string endstr = fromfld.substr(end, fromfld.size());
130 string bodystr = fromfld.substr(0, end);
131 for (
int i = 0; i < multiFldIds.size(); ++i)
134 bodystr +
"_" + std::to_string(multiFldIds[i]) + endstr;
135 fromfiles.push_back(infile);
140 for (
int j = 0; j < processFields.size(); ++j)
142 int fid = processFields[j];
144 m_f->m_exp[fid]->BwdTrans(
m_f->m_exp[fid]->GetCoeffs(), SaveFld[j]);
147 if (allfromflds ==
false)
150 for (
int f = 0; f < fromfiles.size(); ++f)
152 m_f->FieldIOForFile(fromfiles[f])
153 ->Import(fromfiles[f], fromField->m_fielddef, fromField->m_data,
156 totiprod =
IProduct(processFields, fromField, SaveFld);
158 if (
m_f->m_comm->GetSpaceComm()->GetRank() == 0)
160 cout <<
"Inner Product WRT " << fromfiles[f] <<
" : "
171 for (
int i = 0; i < fromfiles.size(); ++i)
173 allFromField[i] = std::shared_ptr<Field>(
new Field());
175 m_f->FieldIOForFile(fromfiles[i])
176 ->Import(fromfiles[i], allFromField[i]->m_fielddef,
177 allFromField[i]->m_data,
181 for (
int g = 0; g < fromfiles.size(); ++g)
183 for (
int j = 0; j < processFields.size(); ++j)
185 int fid = processFields[j];
188 for (
int i = 0; i < allFromField[g]->m_data.size(); ++i)
190 m_f->m_exp[fid]->ExtractDataToCoeffs(
191 allFromField[g]->m_fielddef[i],
192 allFromField[g]->m_data[i],
m_f->m_variables[fid],
196 m_f->m_exp[fid]->BwdTrans(coeffs, SaveFld[j]);
200 for (
int f = g; f < fromfiles.size(); ++f)
202 totiprod =
IProduct(processFields, allFromField[f], SaveFld);
204 if (
m_f->m_comm->GetSpaceComm()->GetRank() == 0)
206 cout <<
"Inner Product of " << fromfiles[g] <<
" WRT "
207 << fromfiles[f] <<
" : " << totiprod << endl;
218 int nphys =
m_f->m_exp[0]->GetTotPoints();
221 for (
int j = 0; j < processFields.size(); ++j)
223 int fid = processFields[j];
229 for (
int i = 0; i < fromField->m_data.size(); ++i)
231 m_f->m_exp[fid]->ExtractDataToCoeffs(fromField->m_fielddef[i],
232 fromField->m_data[i],
233 m_f->m_variables[fid], coeffs);
236 m_f->m_exp[fid]->BwdTrans(coeffs, phys);
238 Vmath::Vmul(nphys, SaveFld[j], 1, phys, 1, phys, 1);
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.