53 ProcessAddFld::create,
"rescale input field by a constant factor.");
60 "Fld file form which to interpolate field");
63 "Need to specify fromfld=file.fld ");
75 cout <<
"ProcessAddFld: Adding new fld to input fld" << endl;
78 ASSERTL0(
m_f->m_data.size() != 0,
"No input data defined");
80 string scalestr =
m_config[
"scale"].as<
string>();
83 string fromfld =
m_config[
"fromfld"].as<
string>();
90 for (
int i = 0; i <
m_f->m_exp[0]->GetExpSize(); ++i)
92 ElementGIDs[i] =
m_f->m_exp[0]->GetExp(i)->GetGeom()->GetGlobalID();
94 m_f->m_fld->Import(fromfld,fromField->m_fielddef,
101 m_f->m_fld->Import(fromfld,fromField->m_fielddef,
106 bool samelength =
true;
107 if(fromField->m_data.size() !=
m_f->m_data.size())
113 for(
int i = 0; i < fromField->m_data.size(); ++i)
115 int datalen = fromField->m_data[i].size();
117 Vmath::Smul(datalen, scale, &(fromField->m_data[i][0]), 1,
118 &(fromField->m_data[i][0]), 1);
122 if(datalen !=
m_f->m_data[i].size())
129 if(samelength ==
true)
131 for(
int i = 0; i <
m_f->m_data.size(); ++i)
133 int datalen =
m_f->m_data[i].size();
136 &(fromField->m_data[i][0]), 1,
137 &(
m_f->m_data[i][0]), 1);
143 "Input fields have partitions of different length and so xml "
144 "file needs to be specified");
146 int nfields =
m_f->m_fielddef[0]->m_fields.size();
147 int ncoeffs =
m_f->m_exp[0]->GetNcoeffs();
150 for (
int j = 0; j < nfields; ++j)
155 for (
int i = 0; i < fromField->m_data.size(); ++i)
157 m_f->m_exp[j]->ExtractDataToCoeffs(
158 fromField->m_fielddef[i],
159 fromField->m_data[i],
160 fromField->m_fielddef[i]->m_fields[j],
161 m_f->m_exp[j]->UpdateCoeffs());
166 m_f->m_exp[j]->UpdateCoeffs(), 1);
169 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
170 =
m_f->m_exp[0]->GetFieldDefinitions();
171 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
173 for(
int i = 0; i < nfields; ++i)
175 for (
int j = 0; j < FieldDef.size(); ++j)
177 FieldDef[j]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[i]);
178 m_f->m_exp[i]->AppendFieldData(FieldDef[j], FieldData[j]);
182 m_f->m_fielddef = FieldDef;
183 m_f->m_data = FieldData;
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
boost::shared_ptr< Field > FieldSharedPtr
Represents a command-line configuration option.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
static FieldMetaDataMap NullFieldMetaDataMap
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.