|
dune-fem 2.12-git
|
Loading...
Searching...
No Matches
codegen.hh
Go to the documentation of this file.
269 file << " struct EvaluateImplementation< Traits, " << dimRange << " , " << quadNop << " , " << numBase << " >" << std::endl;
270 file << " : public EvaluateRealImplementation< Traits, " << dimRange << " , " << quadNop << " , " << numBase << " >" << std::endl;
272 file << " typedef EvaluateRealImplementation< Traits, " << dimRange << " , " << quadNop << " , " << numBase << " > BaseType;" << std::endl;
274 file << " EvaluateImplementation( const RangeVectorType& rv ) : BaseType ( rv ) {}" << std::endl;
424 static void writeInnerLoopEval(std::ostream& out, const int simdW, const int dimRange, const size_t numRows, const size_t numCols )
463 out << "template <class BaseFunctionSet> // dimRange = "<< dimRange << ", quadNop = " << numRows << ", scalarBasis = " << numCols << std::endl;
464 out << "struct EvaluateRanges<BaseFunctionSet, EmptyGeometry, " << dimRange << ", " << numRows << ", " << numCols << ">" << std::endl;
481 //out << " static Dune::Fem::ThreadSafeValue< std::vector< Field > > memory( " << numRows * dimRange << " );" << std::endl;
482 out << " static thread_local std::vector< Field > memory( " << numRows * dimRange << " );" << std::endl;
487 out << " for( int i=0; i < " << numRows * dimRange << "; ++ i ) resultTmp[ i ] = 0;" << std::endl <<std::endl;
504 out << " for( int col = 0, dof = 0 ; col < "<< simdCols <<" ; col += " << simdWidth << ", dof += " << simdWidth * dimRange<< " )"<<std::endl;
590 static void writeInnerLoop(std::ostream& out, const int simdW, const int dimRange, const size_t numCols )
596 out << " const " << doubletype() << " fac" << i << r << " = rangeFactor" << i << "[ " << r << " ];" << std::endl;
609 out << " const " << doubletype() << " phi" << i << " = rangeStorage[ rowCol ][ 0 ];" << std::endl;
633 out << "template <class BaseFunctionSet> // dimRange = "<< dimRange << ", quadNop = " << numRows << ", scalarBasis = " << numCols << std::endl;
634 out << "struct AxpyRanges<BaseFunctionSet, EmptyGeometry, " << dimRange << ", " << numRows << ", " << numCols << ">" << std::endl;
656 out << " static thread_local std::vector< Field > memory( " << numCols * dimRange << " );" << std::endl;
657 //out << " static Dune::Fem::ThreadSafeValue< std::vector< Field > > memory( " << numCols * dimRange << " );" << std::endl;
661 out << " for( int i=0; i < " << numCols * dimRange << "; ++i ) dofResult[ i ] = 0;" << std::endl << std::endl;
665 out << " " << doubletype() << "* dofs" << r << " = dofResult + " << r * numCols << ";" << std::endl;
672 out << " for( int row = 0; row < "<< simdRows << " ; row += " << int(simdWidth) << " )" << std::endl;
675 out << " const " << doubletype() << "* rangeFactor" << i << " = &rangeFactors[ row + " << i << " ][ 0 ];" << std::endl;
681 out << " &rangeStorage[ quad.cachingPoint( row + " << i << " ) * " << numCols << " ][ 0 ]," << std::endl;
731 out << " const " << doubletype() << "* " << restrictKey() << " rangeFactor" << i << "," << std::endl;
757 out << " const GeometryJacobianType& gjit = geometry.jacobianInverseTransposed( quad.point( row ) );" << std::endl << std::endl;
761 out << " gjit.mv( jacStorage[ idx" << plusplus << " ][ 0 ], gradPhi" << i << " );" << std::endl;
763 out << " const " << doubletype() << " phi" << i << d << " = gradPhi" << i << "[ " << d << " ];" << std::endl;
771 //out << " gjit.mv( jacStorage[ idx" << plusplus << " ][ 0 ], gradPhi" << i << " );" << std::endl;
773 out << " const " << doubletype() << " phi" << i << d << " = gradPhi" << i << "[ " << d << " ];" << std::endl;
776 // out << " const "<< doubletype() << "* base" << i << " = jacobians + (" << dim * numRows << " * (col + "<< i << "));" << std::endl;
779 //out << " gjit.mv( jacStorage[ idx" << plusplus << " ][ 0 ], gradPhi" << i << " );" << std::endl;
781 out << " const " << doubletype() << " phi" << i << d << " = base" << i << "[ row * " << dim << " + " << d << " ];" << std::endl;
791 out << " const " << doubletype() << " phi" << i << d << " = base" << i << "[ idx + " << d << " ];" << std::endl;
815 out << "template <class BaseFunctionSet> // dimRange = "<< dimRange << ", quadNop = " << numRows << ", scalarBasis = " << numCols << std::endl;
816 out << "struct EvaluateJacobians<BaseFunctionSet, EmptyGeometry, " << dimRange << ", " << numRows << ", " << numCols << ">" << std::endl;
828 out << " std::cerr << \"ERROR: wrong code generated for VectorialBaseFunctionSet::axpyJacobians\" << std::endl;" << std::endl;
832 out << "template <class BaseFunctionSet, class Geometry> // dimRange = "<< dimRange << ", quadNop = " << numRows << ", scalarBasis = " << numCols << std::endl;
833 out << "struct EvaluateJacobians<BaseFunctionSet, Geometry, " << dimRange << ", " << numRows << ", " << numCols << ">" << std::endl;
845 out << " evalJac( quad, geometry, jacStorage, dofs, jacFactors, jacFactors[ 0 ] );" << std::endl;
863 out << " typedef typename Geometry::JacobianInverseTransposed GeometryJacobianType;" << std::endl;
868 //out << " static Dune::Fem::ThreadSafeValue< std::vector< Field > > memory( " << nDofs << " );" << std::endl;
873 //out << " Field* resultTmp" << d << " = (*memory).data() + " << d * numRows * dimRange << ";" << std::endl;
874 out << " Field* resultTmp" << d << " = memory.data() + " << d * numRows * dimRange << ";" << std::endl;
886 out << " Field* result" << r << d <<" = resultTmp" << d << " + " << r * numRows << " ;" << std::endl;
901 out << " Field* base" << i << d << " = memory.data() + " << nDofs + ((d * simdWidth) + i) * numRows << ";" << std::endl;
909 out << " for( int col = 0, dof = 0 ; col < "<< simdNumCols <<" ; col += " << simdWidth << ", dof += " << simdWidth * dimRange<< " )"<<std::endl;
915 out << " // use reference to GeometryJacobianType to make code compile with SPGrid Geometry" << std::endl;
917 //out << " const GeometryJacobianType& gjit = geometry.jacobianInverseTransposed( quad.point( row ) );" << std::endl << std::endl;
922 out << " gjit.mv( jacStorage[ idx" << plusplus << " ][ 0 ], gradPhi" << i << " );" << std::endl;
945 out << " const "<< doubletype() << "* base" << i << " = jacobians + (" << dim * numRows << " * (col + "<< i << "));" << std::endl;
973 out << " for( int col = " << simdNumCols << ", dof = " << simdNumCols * dimRange << " ; col < " << numCols << " ; ++col )" << std::endl;
975 out << " const "<< doubletype() << "* base0" << " = jacobians + (" << dim * numRows << " * col);" << std::endl;
1035 static void writeInnerLoopAxpyJac(std::ostream& out, const int dim, const int dimRange, const size_t numCols )
1040 out << " const " << doubletype() << " phi" << d << " = base[ (col * " << dim << ") + " << d << " ];" << std::endl;
1060 out << "template <class BaseFunctionSet> // dimRange = "<< dimRange << ", quadNop = " << numRows << ", scalarBasis = " << numCols << std::endl;
1061 out << "struct AxpyJacobians<BaseFunctionSet, EmptyGeometry, " << dimRange << ", " << numRows << ", " << numCols << ">" << std::endl;
1073 out << " std::cerr << \"ERROR: wrong code generated for VectorialBaseFunctionSet::axpyJacobians\" << std::endl;" << std::endl;
1078 out << "struct AxpyJacobians<BaseFunctionSet, Geometry, " << dimRange << ", " << numRows << ", " << numCols << ">" << std::endl;
1091 out << " typedef typename JacobianRangeFactorType :: value_type JacobianRangeType;" << std::endl << std::endl;
1096 //out << " static Dune::Fem::ThreadSafeValue< std::vector< Field > > memory( " << dofs << " );" << std::endl;
1100 out << " for( int i = 0 ; i < " << dofs << "; ++i ) result[ i ] = 0;" << std::endl << std::endl;
1115 out << " typedef typename Geometry::JacobianInverseTransposed GeometryJacobianType;" << std::endl;
1116 out << " // use reference to GeometryJacobianType to make code compile with SPGrid Geometry" << std::endl;
1117 out << " const GeometryJacobianType& gjit = geometry.jacobianInverseTransposed( quad.point( row ) );" << std::endl << std::endl;
1124 out << " for( int col = 0, rowCol = quad.cachingPoint( row ) * " << numCols << "; col < " << numCols << " ; ++ col, ++rowCol )" << std::endl;
1154 out << " // sum up results (transform from variable based to point based layout)" << std::endl;
1335 file << "// this is the file containing the necessary includes for the specialized codes" << std::endl;
const char * name()
int size() const
size_type dim() const
#define DUNE_THROW(E,...)
iterator(ParallelIndexSet< TG, TL, N > &indexSet, const Father &father)
bool createDirectory(const std::string &inName)
create a directory
Definition io.cc:19
IteratorRange< typename DF::DofIteratorType > dofs(DF &df)
Iterates over all DOFs.
Definition rangegenerators.hh:76
void generateCode(const DiscreteFunctionSpace &space, const Vector &elemQuadOrders, const Vector &faceQuadOrders, const std::string &outpath="./", const std::string &filename="autogeneratedcode.hh")
Definition codegen.hh:1217
std::string autoFilename(const int dim, const int polynomialOrder)
Definition codegen.hh:1206
DefaultCodeGenerator< 4 > CodeGeneratorType
Definition codegen.hh:1201
Definition grcommon.hh:31
quadrature class supporting base function caching
Definition cachingquadrature.hh:106
Definition codegen.hh:29
Definition codegen.hh:32
void setPath(const std::string &path)
overwrite path
Definition codegen.hh:96
void setFileName(const std::string &filename)
overwrite filename
Definition codegen.hh:99
void addEntry(const std::string &fileprefix, codegenfunc_t *codegenfunc, const int dim, const int dimRange, const int quadNop, const int numBase)
Definition codegen.hh:116
void addDimRange(const BaseSet *baseSet, const int dimRange)
Definition codegen.hh:102
void clear()
clear all registered entries
Definition codegen.hh:83
bool dumpInfo(const bool writeToCurrentDir=false) const
Definition codegen.hh:218
int exists(const std::string &filename) const
Definition codegen.hh:328
static std::string generateFunctionName(const std::string &prefix, const int simdW, const int dimRange, const size_t numRows, const size_t numCols)
Definition codegen.hh:415
static void writeInnerLoopEval(std::ostream &out, const int simdW, const int dimRange, const size_t numRows, const size_t numCols)
Definition codegen.hh:424
static void writeInnerLoop(std::ostream &out, const int simdW, const int dimRange, const size_t numCols)
Definition codegen.hh:590
static void evaluateJacobiansCodegen(std::ostream &out, const int dim, const int dimRange, const size_t numRows, const size_t numCols)
Definition codegen.hh:807
static void writePreCompHeader(std::ostream &out, const int stage)
Definition codegen.hh:383
static void axpyCodegen(std::ostream &out, const int dim, const int dimRange, const size_t numRows, const size_t numCols)
Definition codegen.hh:625
static void writeInnerJacEvalLoop(std::ostream &out, const int simdW, const int dim, const int dimRange, const size_t numRows, const size_t numCols)
Definition codegen.hh:748
static const char * doubletype()
Definition codegen.hh:374
static void evaluateCodegen(std::ostream &out, const int dim, const int dimRange, const size_t numRows, const size_t numCols)
Definition codegen.hh:452
static const char * restrictKey()
Definition codegen.hh:369
static void axpyJacobianCodegen(std::ostream &out, const int dim, const int dimRange, const size_t numRows, const size_t numCols)
Definition codegen.hh:1052
static void writeInnerLoopAxpyJac(std::ostream &out, const int dim, const int dimRange, const size_t numCols)
Definition codegen.hh:1035
discrete function space
T begin(T... args)
T c_str(T... args)
T clear(T... args)
T close(T... args)
T end(T... args)
T endl(T... args)
T erase(T... args)
T find(T... args)
T insert(T... args)
T make_pair(T... args)
T max(T... args)
T min(T... args)
T push_back(T... args)
T rdbuf(T... args)
T size(T... args)
T str(T... args)
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8