40 #include <boost/core/ignore_unused.hpp> 
   55         ProcessMultiShear::create,
 
   56         "Computes shear stress metrics.");
 
   63         "First fld file. First underscore flags position of id in name.");
 
   75     if (
m_f->m_exp[0]->GetNumElmts() == 0)
 
   81              "Need to specify fromfld=file.fld ");
 
   83     int nstart, i, j, nfields=0;
 
   86     string fromfld, basename, endname, nstartStr;
 
   87     stringstream filename;
 
   88     vector<string> infiles(nfld);
 
   89     vector<std::shared_ptr<Field> > fromField(nfld);
 
   92     fromfld  = 
m_config[
"fromfld"].as<
string>();
 
   93     basename = fromfld.substr(0, fromfld.find_first_of(
"_") + 1);
 
   94     filename << fromfld.substr(fromfld.find_first_of(
"_") + 1, fromfld.size());
 
   98     filename >> nstartStr;
 
  100     endname = fromfld.substr(fromfld.find(nstartStr) + nstartStr.size(),
 
  103     for (i = 0; i < nfld; ++i)
 
  105         stringstream filename;
 
  106         filename << basename << i + nstart << endname;
 
  107         filename >> infiles[i];
 
  108         cout << infiles[i] << endl;
 
  111     for (i = 0; i < nfld; ++i)
 
  113         fromField[i]            = std::shared_ptr<Field>(
new Field());
 
  114         fromField[i]->m_session = 
m_f->m_session;
 
  115         fromField[i]->m_graph   = 
m_f->m_graph;
 
  119     for (i = 0; i < nfld; ++i)
 
  121         if (
m_f->m_exp.size())
 
  125             for (j = 0; j < 
m_f->m_exp[0]->GetExpSize(); ++j)
 
  128                     m_f->m_exp[0]->GetExp(j)->GetGeom()->GetGlobalID();
 
  130             m_f->FieldIOForFile(infiles[i])->Import(
 
  131                 infiles[i], fromField[i]->m_fielddef, fromField[i]->m_data,
 
  136             m_f->FieldIOForFile(infiles[i])->Import(
 
  137                 infiles[i], fromField[i]->m_fielddef, fromField[i]->m_data,
 
  141         nfields = fromField[i]->m_fielddef[0]->m_fields.size();
 
  142         int NumHomogeneousDir =
 
  143             fromField[i]->m_fielddef[0]->m_numHomogeneousDir;
 
  145         if (nfields == 5 || nfields == 7)
 
  151         fromField[i]->m_graph->SetExpansionInfo(fromField[i]->m_fielddef);
 
  154         fromField[i]->m_exp.resize(nfields);
 
  155         fromField[i]->m_exp[0] =
 
  156             fromField[i]->SetUpFirstExpList(NumHomogeneousDir, 
true);
 
  158         for (j = 1; j < nfields; ++j)
 
  160             fromField[i]->m_exp[j] = 
m_f->AppendExpList(NumHomogeneousDir);
 
  163         for (j = 0; j < nfields; ++j)
 
  165             for (
int k = 0; k < fromField[i]->m_data.size(); ++k)
 
  167                 fromField[i]->m_exp[j]->ExtractDataToCoeffs(
 
  168                     fromField[i]->m_fielddef[k], fromField[i]->m_data[k],
 
  169                     fromField[i]->m_fielddef[k]->m_fields[j],
 
  170                     fromField[i]->m_exp[j]->UpdateCoeffs());
 
  172             fromField[i]->m_exp[j]->BwdTrans(
 
  173                 fromField[i]->m_exp[j]->GetCoeffs(),
 
  174                 fromField[i]->m_exp[j]->UpdatePhys());
 
  178     int spacedim = 
m_f->m_graph->GetSpaceDimension();
 
  179     if ((fromField[0]->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
 
  180         (fromField[0]->m_fielddef[0]->m_numHomogeneousDir) == 2)
 
  191     int npoints = fromField[0]->m_exp[0]->GetNpoints();
 
  193         normCrossDir(spacedim), outfield(nout), dtemp(spacedim);
 
  195         DotProduct(npoints, 0.0), temp(npoints, 0.0);
 
  197     for (i = 0; i < spacedim; ++i)
 
  206     for (i = 0; i < nout; ++i)
 
  214     for (i = 0; i < nfld; ++i)
 
  216         for (j = 0; j < spacedim; ++j)
 
  218             Vmath::Vadd(npoints, fromField[i]->m_exp[j]->GetPhys(), 1,
 
  219                         normTemporalMeanVec[j], 1, normTemporalMeanVec[j], 1);
 
  223     for (i = 0; i < spacedim; ++i)
 
  225         Vmath::Smul(npoints, 1.0 / nfld, normTemporalMeanVec[i], 1,
 
  226                     normTemporalMeanVec[i], 1);
 
  227         Vmath::Vvtvp(npoints, normTemporalMeanVec[i], 1, normTemporalMeanVec[i],
 
  228                      1, TemporalMeanMag, 1, TemporalMeanMag, 1);
 
  231     Vmath::Vsqrt(npoints, TemporalMeanMag, 1, TemporalMeanMag, 1);
 
  233     for (i = 0; i < spacedim; ++i)
 
  235         Vmath::Vdiv(npoints, normTemporalMeanVec[i], 1, TemporalMeanMag, 1,
 
  236                     normTemporalMeanVec[i], 1);
 
  243         Vmath::Vmul(npoints, fromField[0]->m_exp[nfields - 1]->GetPhys(), 1,
 
  244                     normTemporalMeanVec[1], 1, normCrossDir[0], 1);
 
  245         Vmath::Vvtvm(npoints, fromField[0]->m_exp[nfields - 2]->GetPhys(), 1,
 
  246                      normTemporalMeanVec[2], 1, normCrossDir[0], 1,
 
  249         Vmath::Vmul(npoints, fromField[0]->m_exp[nfields - 3]->GetPhys(), 1,
 
  250                     normTemporalMeanVec[2], 1, normCrossDir[1], 1);
 
  251         Vmath::Vvtvm(npoints, fromField[0]->m_exp[nfields - 1]->GetPhys(), 1,
 
  252                      normTemporalMeanVec[0], 1, normCrossDir[1], 1,
 
  255         Vmath::Vmul(npoints, fromField[0]->m_exp[nfields - 2]->GetPhys(), 1,
 
  256                     normTemporalMeanVec[0], 1, normCrossDir[2], 1);
 
  257         Vmath::Vvtvm(npoints, fromField[0]->m_exp[nfields - 3]->GetPhys(), 1,
 
  258                      normTemporalMeanVec[1], 1, normCrossDir[2], 1,
 
  263     for (i = 0; i < nfld; ++i)
 
  265         for (j = 0; j < spacedim; ++j)
 
  267             Vmath::Vvtvp(npoints, fromField[i]->m_exp[j]->GetPhys(), 1,
 
  268                          normTemporalMeanVec[j], 1, DotProduct, 1, DotProduct,
 
  273         Vmath::Vadd(npoints, fromField[i]->m_exp[spacedim]->GetPhys(), 1,
 
  274                     outfield[0], 1, outfield[0], 1);
 
  277         Vmath::Vmul(npoints, DotProduct, 1, DotProduct, 1, temp, 1);
 
  278         Vmath::Vvtvm(npoints, fromField[i]->m_exp[spacedim]->GetPhys(), 1,
 
  279                      fromField[i]->m_exp[spacedim]->GetPhys(), 1, temp, 1,
 
  282         for (j = 0; j < npoints; ++j)
 
  286                 outfield[1][j] = outfield[1][j] + 
sqrt(temp[j]);
 
  292                     fromField[i]->m_exp[spacedim]->GetPhys(), 1, temp, 1);
 
  293         Vmath::Vadd(npoints, temp, 1, outfield[3], 1, outfield[3], 1);
 
  296         for (j = 0; j < npoints; ++j)
 
  298             temp[j] = 1 - temp[j] * temp[j];
 
  301                 outfield[4][j] = outfield[4][j] + 
sqrt(temp[j]);
 
  311             fromField[i]->m_exp[0]->PhysDeriv(DotProduct, dtemp[0], dtemp[1],
 
  313             for (j = 0; j < spacedim; j++)
 
  315                 Vmath::Vvtvp(npoints, dtemp[j], 1, normTemporalMeanVec[j], 1,
 
  323             for (j = 0; j < spacedim; ++j)
 
  325                 Vmath::Vvtvp(npoints, fromField[i]->m_exp[j]->GetPhys(), 1,
 
  326                              normCrossDir[j], 1, DotProduct, 1, DotProduct, 1);
 
  328             fromField[i]->m_exp[0]->PhysDeriv(DotProduct, dtemp[0], dtemp[1],
 
  332             for (j = 0; j < spacedim; j++)
 
  335                              DotProduct, 1, DotProduct, 1);
 
  337             Vmath::Vvtvp(npoints, DotProduct, 1, DotProduct, 1, temp, 1, temp,
 
  342             Vmath::Vadd(npoints, temp, 1, outfield[5], 1, outfield[5], 1);
 
  349     Vmath::Smul(npoints, 1.0 / nfld, outfield[0], 1, outfield[0], 1);
 
  350     Vmath::Smul(npoints, 1.0 / nfld, outfield[1], 1, outfield[1], 1);
 
  351     Vmath::Smul(npoints, 1.0 / nfld, outfield[3], 1, outfield[3], 1);
 
  352     Vmath::Smul(npoints, 1.0 / nfld, outfield[4], 1, outfield[4], 1);
 
  355     for (i = 0; i < npoints; ++i)
 
  357         outfield[2][i] = 0.5 * (1 - TemporalMeanMag[i] / outfield[0][i]);
 
  367     m_f->m_exp.resize(nout);
 
  368     m_f->m_fielddef = fromField[0]->m_fielddef;
 
  370         m_f->SetUpFirstExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir, 
true);
 
  372     for (i = 1; i < nout; ++i)
 
  375             m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
 
  378     m_f->m_fielddef[0]->m_fields.resize(nout);
 
  379     m_f->m_fielddef[0]->m_fields[0] = 
"TAWSS";
 
  380     m_f->m_fielddef[0]->m_fields[1] = 
"transWSS";
 
  381     m_f->m_fielddef[0]->m_fields[2] = 
"OSI";
 
  382     m_f->m_fielddef[0]->m_fields[3] = 
"TAAFI";
 
  383     m_f->m_fielddef[0]->m_fields[4] = 
"TACFI";
 
  387         m_f->m_fielddef[0]->m_fields[5] = 
"|WSSG|";
 
  388         Vmath::Smul(npoints, 1.0 / nfld, outfield[5], 1, outfield[5], 1);
 
  391     m_f->m_variables = 
m_f->m_fielddef[0]->m_fields;
 
  393     for (i = 0; i < nout; ++i)
 
  395         m_f->m_exp[i]->FwdTrans(outfield[i], 
m_f->m_exp[i]->UpdateCoeffs());
 
  396         m_f->m_exp[i]->BwdTrans(
m_f->m_exp[i]->GetCoeffs(),
 
  397                                 m_f->m_exp[i]->UpdatePhys());
 
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
Abstract base class for processing modules.
virtual ~ProcessMultiShear()
virtual void Process(po::variables_map &vm)
Write mesh to output file.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
static FieldMetaDataMap NullFieldMetaDataMap
The above copyright notice and this permission notice shall be included.
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
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.
void Vvtvm(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvm (vector times vector plus vector): z = w*x - y
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
void Zero(int n, T *x, const int incx)
Zero vector.
scalarT< T > sqrt(scalarT< T > in)
Represents a command-line configuration option.