21         fprintf(stderr,
"Usage: FldAddScalGrad meshfile infld outfld BoundaryID\n");
 
   25     surfID = boost::lexical_cast<
int>(argv[argc - 1]);
 
   27     argv[argc -1] = argv[argc - 2];
 
   30             = LibUtilities::SessionReader::CreateInstance(argc, argv);
 
   34     string meshfile(argv[argc-4]);
 
   40     string fieldfile(argv[argc-3]);
 
   41     vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
 
   42     vector<vector<NekDouble> > fielddata;
 
   48     int expdim  = graphShPt->GetMeshDimension();
 
   58             ASSERTL0(
false,
"Expansion dimension not recognised");
 
   63             ASSERTL0(
false,
"Expansion dimension not recognised");
 
   71                                     vSession->GetVariable(0));
 
   73             m_locToGlobalMap = originalfield->GetLocalToGlobalMap();
 
   75             exp[0] = originalfield;
 
   76             for (i=0; i<addfields; i++)
 
   80                                         vSession->GetVariable(0));
 
   85             ASSERTL0(
false,
"Expansion dimension not recognised");
 
   92     for(j = 0; j < nfields+addfields; ++j)
 
   94         for(
int i = 0; i < fielddata.size(); ++i)
 
   96             exp[j]->ExtractDataToCoeffs(fielddef [i],
 
   98                                         fielddef [i]->m_fields[0],
 
   99                                         exp[j]->UpdateCoeffs());
 
  102         exp[j]->BwdTrans(exp[j]->GetCoeffs(),exp[j]->UpdatePhys());
 
  109     int n, cnt, elmtid, nq, offset, nt, boundary, nfq;
 
  110     nt = exp[0]->GetNpoints();
 
  124     exp[0]->GetBoundaryToElmtMap(BoundarytoElmtID,BoundarytoTraceID); 
 
  127     for (i = 0; i<addfields; i++)
 
  129         BndExp[i] = exp[i]->GetBndCondExpansions();
 
  133     for(cnt = n = 0; n < BndExp[0].num_elements(); ++n)
 
  138             for(i = 0; i < BndExp[0][n]->GetExpSize(); ++i, cnt++)
 
  141                 elmtid = BoundarytoElmtID[cnt];
 
  142                 elmt   = exp[0]->GetExp(elmtid);
 
  143                 nq     = elmt->GetTotPoints();
 
  144                 offset = exp[0]->GetPhys_Offset(elmtid);
 
  148                 for(j = 0; j < expdim; ++j)
 
  158                     for (j = 0; j< addfields; j++)
 
  160                         values[j] = BndExp[j][n]->UpdateCoeffs() + BndExp[j][n]->GetCoeff_Offset(i);
 
  170                     boundary = BoundarytoTraceID[cnt];
 
  173                     U = exp[0]->GetPhys() + offset;
 
  176                     elmt->PhysDeriv(U,grad[0],grad[1],grad[2]);
 
  180                         for (j = 0; j< nq; j++)
 
  182                             cout << 
"element grad: " << grad[0][j] << endl;
 
  186                     for(j = 0; j < expdim; ++j)
 
  193                     for(j = 0; j < expdim; ++j)
 
  195                         elmt->GetFacePhysVals(boundary,bc,grad[j],fgrad[j]); 
 
  196                         bc->FwdTrans(fgrad[j],values[j]);
 
  201                         for (j = 0; j< nfq; j++)
 
  203                             cout << 
"face grad: " << fgrad[0][j] << endl;
 
  210                                 = elmt->GetFaceNormal(boundary);
 
  217                                        normals[1],1,fgrad[1],1,gradnorm,1);
 
  218                         Vmath::Vvtvp  (nfq,normals[2],1,fgrad[2],1,gradnorm,1,gradnorm,1);
 
  223                                           normals[1][0],fgrad[1],1,gradnorm,1);
 
  224                         Vmath::Svtvp(nfq,normals[2][0],fgrad[2],1,gradnorm,1,gradnorm,1);
 
  227                     for(j = 0; j<expdim; j++)
 
  229                         bc->FwdTrans(normals[j],values[j+expdim]);
 
  234                     bc->FwdTrans(gradnorm,values[expdim*2]);
 
  241             cnt += BndExp[0][n]->GetExpSize();
 
  245     for(j = 0; j < addfields; ++j)
 
  247         int ncoeffs = exp[0]->GetNcoeffs();
 
  250         output=exp[j+1]->UpdateCoeffs();
 
  252         int nGlobal=m_locToGlobalMap->GetNumGlobalCoeffs();
 
  260         for(
int i = 0; i < BndExp[j].num_elements(); ++i)
 
  265                 for(
int k = 0; k < (BndExp[j][i])->GetNcoeffs(); ++k)
 
  267                     sign = m_locToGlobalMap->GetBndCondCoeffsToGlobalCoeffsSign(bndcnt);
 
  268                     outarray[map[bndcnt++]] = sign * coeffs[k];
 
  273                 bndcnt += BndExp[j][i]->GetNcoeffs();
 
  276         m_locToGlobalMap->GlobalToLocal(outarray,output);
 
  282     string   out(argv[argc-2]);
 
  283     std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
 
  284                                                 = exp[0]->GetFieldDefinitions();
 
  285     std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
 
  287     vector<string > outname;
 
  289     outname.push_back(
"du/dx");
 
  290     outname.push_back(
"du/dy");
 
  291     outname.push_back(
"du/dz");
 
  292     outname.push_back(
"nx");
 
  293     outname.push_back(
"ny");
 
  294     outname.push_back(
"nz");
 
  295     outname.push_back(
"gradient");
 
  298     for(j = 0; j < nfields+addfields; ++j)
 
  300         for(i = 0; i < FieldDef.size(); ++i)
 
  304                 FieldDef[i]->m_fields.push_back(outname[j-nfields]);
 
  308                 FieldDef[i]->m_fields.push_back(fielddef[i]->m_fields[j]);
 
  310             exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
 
#define ASSERTL0(condition, msg)
#define sign(a, b)
return the sign(b)*a 
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
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 
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file. 
int GetTotPoints() const 
This function returns the total number of quadrature points used in the element. 
boost::shared_ptr< StdExpansion2D > StdExpansion2DSharedPtr
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< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object. 
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector): 
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
vvtvvtp (scalar times vector plus scalar times vector): 
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap)
Write a field file in serial only. 
boost::shared_ptr< ContField3D > ContField3DSharedPtr
boost::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Geometry is curved or has non-constant factors.