54         ProcessScalGrad::create, 
"Computes scalar gradient field.");
 
   59     f->m_writeBndFld = 
true;
 
   60     f->m_declareExpansionAsContField = 
true;
 
   61     m_f->m_fldToBnd = 
false;
 
   72         if(
m_f->m_comm->TreatAsRankZero())
 
   74             cout << 
"ProcessScalGrad: Calculating scalar gradient..." << endl;
 
   81     string bvalues =  
m_config[
"bnd"].as<
string>();
 
   83     if(bvalues.compare(
"All") == 0)
 
   86             BndExp = 
m_f->m_exp[0]->GetBndCondExpansions();
 
   88         for(i = 0; i < BndExp.num_elements(); ++i)
 
   90             m_f->m_bndRegionsToWrite.push_back(i);
 
   96                                                    m_f->m_bndRegionsToWrite),
"Failed to interpret range string");
 
   99     int spacedim  = 
m_f->m_graph->GetSpaceDimension();
 
  100     if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
 
  101         (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
 
  106     int nfields = 
m_f->m_fielddef[0]->m_fields.size();
 
  111         ASSERTL0(
false, 
"Error: scalar gradient for a 1D problem cannot " 
  116     int ngrad     = spacedim;
 
  117     int n, cnt, elmtid, nq, offset, boundary, nfq;
 
  118     int npoints = 
m_f->m_exp[0]->GetNpoints();
 
  128     m_f->m_exp[0]->GetBoundaryToElmtMap(BoundarytoElmtID, BoundarytoTraceID);
 
  130     for (i = 0; i < nfields; i++)
 
  132         var = 
m_f->m_fielddef[0]->m_fields[i];
 
  133         stringstream filename;
 
  134         filename << var << 
"_scalar_gradient";
 
  136         m_f->m_fielddef[0]->m_fields[i] = var;
 
  138         BndExp[i] = 
m_f->m_exp[i]->GetBndCondExpansions();
 
  143     for(cnt = n = 0; n < BndExp[0].num_elements(); ++n)
 
  145         bool doneBnd = 
false;
 
  147         for(
int b = 0; b < 
m_f->m_bndRegionsToWrite.size(); ++b)
 
  149             if(n == 
m_f->m_bndRegionsToWrite[b])
 
  152                 for(i = 0; i < BndExp[0][n]->GetExpSize(); ++i, cnt++)
 
  155                     elmtid = BoundarytoElmtID[cnt];
 
  156                     elmt   = 
m_f->m_exp[0]->GetExp(elmtid);
 
  157                     nq     = elmt->GetTotPoints();
 
  158                     offset = 
m_f->m_exp[0]->GetPhys_Offset(elmtid);
 
  162                     for(j = 0; j < ngrad; ++j)
 
  173                         for(j = 0; j < nfields; j++)
 
  175                             outfield[j] = BndExp[j][n]->UpdateCoeffs() + BndExp[j][n]->GetCoeff_Offset(i);
 
  183                         boundary = BoundarytoTraceID[cnt];
 
  189                             = elmt->GetFaceNormal(boundary);
 
  192                         for(j = 0; j < ngrad; ++j)
 
  198                         for(k = 0; k < nfields; k++)
 
  202                             scalar = 
m_f->m_exp[k]->GetPhys() + offset;
 
  203                             elmt->PhysDeriv(scalar, grad[0],grad[1],grad[2]);
 
  205                             for(j = 0; j < ngrad; ++j)
 
  207                                 elmt->GetFacePhysVals(boundary,bc,grad[j],fgrad[j]);
 
  213                                 for (j=0; j<ngrad; j++)
 
  215                                     Vmath::Vvtvp(nfq, normals[j], 1, fgrad[j], 1, gradnorm, 1, gradnorm, 1);
 
  220                                 for (j=0; j<ngrad; j++)
 
  222                                     Vmath::Svtvp(nfq, normals[j][0], fgrad[j], 1, gradnorm, 1, gradnorm, 1);
 
  225                             bc->FwdTrans(gradnorm, outfield[k]);
 
  234             cnt += BndExp[0][n]->GetExpSize();
 
  238     for(j = 0; j < nfields; ++j)
 
  240         for(
int b = 0; b < 
m_f->m_bndRegionsToWrite.size(); ++b)
 
  242             m_f->m_exp[j]->UpdateBndCondExpansion(
m_f->m_bndRegionsToWrite[b]) = BndExp[j][
m_f->m_bndRegionsToWrite[b]];
 
#define ASSERTL0(condition, msg)
 
pair< ModuleType, string > ModuleKey
 
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
 
map< string, ConfigOption > m_config
List of configuration values. 
 
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*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 
 
FieldSharedPtr m_f
Field object. 
 
int GetTotPoints() const 
This function returns the total number of quadrature points used in the element. 
 
boost::shared_ptr< StdExpansion2D > StdExpansion2DSharedPtr
 
boost::shared_ptr< Field > FieldSharedPtr
 
Represents a command-line configuration option. 
 
virtual ~ProcessScalGrad()
 
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object. 
 
void Zero(int n, T *x, const int incx)
Zero vector. 
 
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
 
Geometry is curved or has non-constant factors. 
 
ModuleFactory & GetModuleFactory()
 
Abstract base class for processing modules. 
 
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.