Operator.h 103 KB
Newer Older
1001
1002
1003
1004
1005
1006
1007
   * Laplace multiplied with a function which maps the gradient of a DOFVector
   * at each quadrature point to a double:
   * \f$ f(\nabla v(\vec{x})) \Delta u(\vec{x}) \f$
   */
  class VecGradCoordsAtQP_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1008
    /// Constructor.
1009
1010
    VecGradCoordsAtQP_SOT(DOFVectorBase<double> *dv,
			  TertiaryAbstractFunction<double, double,
Thomas Witkowski's avatar
Thomas Witkowski committed
1011
			  WorldVector<double>, WorldVector<double> > *af);
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements SecondOrderTerm::getLALt().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1022
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1023
1024
1025
1026

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1027
1028
    void eval(int nPoints,
	      const double *uhAtQP,
1029
1030
1031
1032
1033
1034
1035
1036
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implenetation of SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1037
    void weakEval(int nPoints,
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
    DOFVectorBase<double>* vec;

    /** \brief
     * Function wich maps \ref gradAtQPs to a double.
     */
    TertiaryAbstractFunction<double, double, WorldVector<double>,
			     WorldVector<double> > *f;

    /** \brief
     * Pointer to a WorldVector<double> array containing the gradients of the DOFVector
     * at each quadrature point.
     */
    double* vecAtQPs;
    WorldVector<double>* gradAtQPs;
    WorldVector<double>* coordsAtQPs;
  
  };


  /**
   * \ingroup Assembler
   *  
   * \brief
   * Laplace operator multiplied with a function evaluated at the quadrature
   * points of a given DOFVector:
   * \f$ -f(v(\vec{x})) \Delta u(\vec{x}) \f$
   */
  class VecAndCoordsAtQP_SOT : public SecondOrderTerm {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1071
    /// Constructor.
1072
    VecAndCoordsAtQP_SOT(DOFVectorBase<double> *dv, 
Thomas Witkowski's avatar
Thomas Witkowski committed
1073
			 BinaryAbstractFunction<double, double, WorldVector<double> > *af);
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1084
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;    
1085

Thomas Witkowski's avatar
Thomas Witkowski committed
1086
1087
    void eval(int nPoints,
	      const double *uhAtQP,
1088
1089
1090
1091
1092
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

Thomas Witkowski's avatar
Thomas Witkowski committed
1093
    void weakEval(int nPoints,
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
    /** \brief
     * DOFVector to be evaluated at quadrature points.
     */
    DOFVectorBase<double>* vec;

    /** \brief
     * Pointer to an array containing the DOFVector evaluated at quadrature
     * points.
     */
    double* vecAtQPs;
  
    WorldVector<double>* coordsAtQPs;

    /** \brief
     * Function evaluated at \ref vecAtQPs.
     */
    BinaryAbstractFunction<double, double,  WorldVector<double> > *f;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * SecondOrderTerm where A is a function which maps the gradient of a 
   * DOFVector at each quadrature point to WorldMatrix<double>:
   * \f$ \nabla \cdot A(\nabla v(\vec{x})) \nabla u(\vec{x})\f$
   */
  class MatrixGradientAndCoords_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1128
    /// Constructor.
1129
1130
1131
    MatrixGradientAndCoords_SOT(DOFVectorBase<double> *dv,
				BinaryAbstractFunction<WorldMatrix<double>,
				WorldVector<double> , 
Thomas Witkowski's avatar
Thomas Witkowski committed
1132
				WorldVector<double> > *af,
1133
				AbstractFunction<WorldVector<double>,
Thomas Witkowski's avatar
Thomas Witkowski committed
1134
1135
				WorldMatrix<double> > *divAf,
				bool symm = false);
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements SecondOrderTerm::getLALt().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1146
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1147
1148
1149
1150

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1151
1152
    void eval(int nPoints,
	      const double *uhAtQP,
1153
1154
1155
1156
1157
1158
1159
1160
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implenetation of SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1161
    void weakEval(int nPoints,
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
    DOFVectorBase<double>* vec;

    /** \brief
     * Function which maps each entry in \ref gradAtQPs to a WorldMatrix<double>.
     */
    BinaryAbstractFunction<WorldMatrix<double>,
			   WorldVector<double>, WorldVector<double> > *f;

    AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divFct;

    /** \brief
     * Pointer to a WorldVector<double> array containing the gradients of the DOFVector
     * at each quadrature point.
     */
    WorldVector<double>* gradAtQPs;

    WorldVector<double>* coordsAtQPs;

    /** \brief
     * True, if \ref f provides always a symmetric WorldMatrix<double>.
     */
    bool symmetric;
  };

1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
  class MatrixVec2_SOT : public SecondOrderTerm 
  {
  public:
    /// Constructor.
    MatrixVec2_SOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,  
		  BinaryAbstractFunction<double, double, double> *f,
		  WorldMatrix<double> Af,
		  bool sym = false);

    /// Implementation of \ref OperatorTerm::initElement().
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /// Implements SecondOrderTerm::getLALt().
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
  
    /// Implenetation of SecondOrderTerm::eval().
    void eval(int nPoints,
	      const double *uhAtQP,
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /// Implenetation of SecondOrderTerm::weakEval().
    void weakEval(int nPoints,
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
    /// DOFVector to be evaluated at quadrature points.
    DOFVectorBase<double>* vec1;
    DOFVectorBase<double>* vec2;

    /// Pointer to the values of the DOFVector at quadrature points.
    double* vec1AtQPs;
    double* vec2AtQPs;

    /// Function for A.
    BinaryAbstractFunction<double, double, double> * fct;

    ///
    WorldMatrix<double> A;

    /// True, if \ref matrixFct produces always symmetric matrices.
    bool symmetric;
  };


1239
1240
1241
  class General_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1242
    /// Constructor.
1243
1244
    General_SOT(std::vector<DOFVectorBase<double>*> vecs,
		std::vector<DOFVectorBase<double>*> grads,
1245
1246
		TertiaryAbstractFunction<WorldMatrix<double>, 
		  WorldVector<double>,
1247
1248
		  std::vector<double>, 
		  std::vector<WorldVector<double> > > *f,
1249
1250
		AbstractFunction<WorldVector<double>, 
		  WorldMatrix<double> > *divFct,
Thomas Witkowski's avatar
Thomas Witkowski committed
1251
		bool symmetric);
1252

1253
1254
    /// Implementation of \ref OperatorTerm::initElement().
    void initElement(const ElInfo*, SubAssembler*, Quadrature *quad= NULL);
1255

1256
    /// Implements SecondOrderTerm::getLALt().
Thomas Witkowski's avatar
Thomas Witkowski committed
1257
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1258

1259
    /// Implenetation of SecondOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
1260
1261
    void eval(int nPoints,
	      const double *uhAtQP,
1262
1263
1264
1265
1266
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

1267
    /// Implenetation of SecondOrderTerm::weakEval().
Thomas Witkowski's avatar
Thomas Witkowski committed
1268
    void weakEval(int nPoints,
1269
1270
1271
1272
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
1273
    std::vector<DOFVectorBase<double>*> vecs_; 
1274

1275
    std::vector<DOFVectorBase<double>*> grads_;
1276
1277
1278

    TertiaryAbstractFunction<WorldMatrix<double>, 
			     WorldVector<double>,
1279
1280
			     std::vector<double>, 
			     std::vector<WorldVector<double> > > *f_;
1281
1282
1283
1284
1285
1286

    AbstractFunction<WorldVector<double>, 
		     WorldMatrix<double> > *divFct_;

    WorldVector<double> *coordsAtQPs_;

1287
    std::vector<double*> vecsAtQPs_;
1288

1289
    std::vector<WorldVector<double>*> gradsAtQPs_;
1290
1291
1292
1293
1294
1295
1296

    bool symmetric_;
  };

  class GeneralParametric_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1297
    /// Constructor.
1298
1299
    GeneralParametric_SOT(std::vector<DOFVectorBase<double>*> vecs,
			  std::vector<DOFVectorBase<double>*> grads,
1300
1301
1302
			  QuartAbstractFunction<WorldMatrix<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
1303
1304
			  std::vector<double>, 
			  std::vector<WorldVector<double> > > *f,
1305
1306
			  AbstractFunction<WorldVector<double>, 
			  WorldMatrix<double> > *divFct,
Thomas Witkowski's avatar
Thomas Witkowski committed
1307
			  bool symmetric);
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo*, 
		     SubAssembler* ,
		     Quadrature *quad= NULL);

    /** \brief
     * Implements SecondOrderTerm::getLALt().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1319
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1320
1321
1322
1323

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1324
1325
    void eval(int nPoints,
	      const double *uhAtQP,
1326
1327
1328
1329
1330
1331
1332
1333
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implenetation of SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1334
    void weakEval(int nPoints,
1335
1336
1337
1338
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
1339
    std::vector<DOFVectorBase<double>*> vecs_; 
1340

1341
    std::vector<DOFVectorBase<double>*> grads_;
1342
1343
1344
1345

    QuartAbstractFunction<WorldMatrix<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
1346
1347
			  std::vector<double>, 
			  std::vector<WorldVector<double> > > *f_;
1348
1349
1350
1351
1352
1353
1354

    AbstractFunction<WorldVector<double>, 
		     WorldMatrix<double> > *divFct_;

    WorldVector<double> *coordsAtQPs_;
    WorldVector<double> elementNormal_;

1355
    std::vector<double*> vecsAtQPs_;
1356

1357
    std::vector<WorldVector<double>*> gradsAtQPs_;
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375

    bool symmetric_;
  };


  // ============================================================================
  // ===== class FirstOrderTerm =================================================
  // ============================================================================

  /**
   * \ingroup Assembler
   * 
   * \brief
   * Describes the first order terms: \f$ b \cdot \nabla u(\vec{x}) \f$
   */
  class FirstOrderTerm : public OperatorTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1376
    /// Constructor.
1377
1378
    FirstOrderTerm(int deg) 
      : OperatorTerm(deg) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1379
    {}
1380

1381
    /// Destructor.
Thomas Witkowski's avatar
Thomas Witkowski committed
1382
    virtual ~FirstOrderTerm() {}
1383

1384
    /// Evaluation of \f$ \Lambda b \f$.
1385
    virtual void getLb(const ElInfo *elInfo,
Thomas Witkowski's avatar
Thomas Witkowski committed
1386
		       int nPoints, 
1387
1388
		       VectorOfFixVecs<DimVec<double> >& result) const = 0;

1389
    /// Implenetation of FirstOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
1390
1391
    void eval(int nPoints,
	      const double *,
1392
1393
1394
1395
1396
1397
1398
1399
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *,
	      double *result,
	      double factor) const 
    {
      int dow = Global::getGeo(WORLD);

      if (grdUhAtQP) {
Thomas Witkowski's avatar
Thomas Witkowski committed
1400
	for (int iq = 0; iq < nPoints; iq++) {
1401
	  double resultQP = 0.0;
1402
	  for (int i = 0; i < dow; i++)
1403
	    resultQP += grdUhAtQP[iq][i];
1404
	  
1405
1406
1407
	  result[iq] += resultQP * factor;
	}
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
1408
    }
1409

Thomas Witkowski's avatar
Thomas Witkowski committed
1410
  };
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421

  /**
   * \ingroup Assembler
   *
   * \brief
   * First order term: \f$ b \cdot \nabla u(\vec{x}) \f$ with a vector b which 
   * only consits of entries equal to one.
   */
  class Simple_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1422
    /// Constructor.
1423
1424
    Simple_FOT() 
      : FirstOrderTerm(0) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1425
    {}
1426

1427
    /// Implements FirstOrderTerm::getLb().
1428
    inline void getLb(const ElInfo *elInfo, 
Thomas Witkowski's avatar
Thomas Witkowski committed
1429
		      int nPoints, 
1430
1431
1432
1433
		      VectorOfFixVecs<DimVec<double> >& Lb) const 
    {
      const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda();

1434
      for (int iq = 0; iq < nPoints; iq++)
1435
	l1(Lambda, Lb[iq], 1.0);
Thomas Witkowski's avatar
Thomas Witkowski committed
1436
    }
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * First order term: \f$ b \cdot \nabla u(\vec{x}) \f$ with a vector b which 
   * only consits of entries equal to one.
   */
  class FactorSimple_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1449
1450
1451
    /// Constructor.
    FactorSimple_FOT(double f) 
      : FirstOrderTerm(0)
1452
    {
1453
      factor = new double;
1454
      *factor = f;
Thomas Witkowski's avatar
Thomas Witkowski committed
1455
    }
1456

Thomas Witkowski's avatar
Thomas Witkowski committed
1457
    /// Constructor.
1458
    FactorSimple_FOT(double *fptr) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1459
      : FirstOrderTerm(0), factor(fptr) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1460
    {}
1461
1462
1463
1464

    /** \brief
     * Implements FirstOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1465
    inline void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const
1466
1467
1468
    {
      const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda();

1469
      for (int iq = 0; iq < nPoints; iq++)
1470
	l1(Lambda, Lb[iq], (*factor));
Thomas Witkowski's avatar
Thomas Witkowski committed
1471
    }
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488

  private:
    /** \brief
     * Pointer to the factor.
     */
    double *factor;
  };

  /**
   * \ingroup Assembler
   *
   * \brief 
   * First order term: \f$ b \cdot \nabla u(\vec{x}) \f$ with a given vector b.
   */
  class Vector_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1489
1490
1491
1492
    /// Constructor.
    Vector_FOT(WorldVector<double> wv) 
      : FirstOrderTerm(0), b(wv) 
    {}
1493

1494
1495
1496
1497
1498
1499
1500
1501
    /// Constructor.
    Vector_FOT(int bIdx) 
      : FirstOrderTerm(0) 
    {
      bOne = bIdx;
    }

    /// Implements FirstOrderTerm::getLb().
1502
    inline void getLb(const ElInfo *elInfo, 
Thomas Witkowski's avatar
Thomas Witkowski committed
1503
		      int nPoints, 
1504
1505
1506
1507
		      VectorOfFixVecs<DimVec<double> >&Lb) const 
    {
      const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda();

1508
1509
1510
1511
1512
1513
1514
      if (bOne > -1) {
	for (int iq = 0; iq < nPoints; iq++)
	  lb_one(Lambda, Lb[iq], 1.0);
      } else {
	for (int iq = 0; iq < nPoints; iq++)
	  lb(Lambda, b, Lb[iq], 1.0);
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
1515
    }
1516

1517
    /// Implements FirstOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
1518
1519
    void eval(int nPoints,
	      const double *,
1520
1521
1522
1523
1524
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *,
	      double *result,
	      double factor) const
    {
1525
      if (grdUhAtQP)
1526
	for (int iq = 0; iq < nPoints; iq++)
1527
	  result[iq] += b * grdUhAtQP[iq] * factor; 
Thomas Witkowski's avatar
Thomas Witkowski committed
1528
    }
1529
1530

  protected:
1531
    /// Vector which is multiplied with \f$ \nabla u(\vec{x}) \f$
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
    WorldVector<double> b;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * Simple_FOT multiplied with \f$ f(v(\vec{x})) \f$.
   */
  class VecAtQP_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1544
    /// Constructor.
1545
    VecAtQP_FOT(DOFVectorBase<double> *dv, 
Thomas Witkowski's avatar
Thomas Witkowski committed
1546
1547
		AbstractFunction<double, double> *af,
		WorldVector<double> *wv);
1548

1549
1550
1551
1552
1553
    /// Constructor.
    VecAtQP_FOT(DOFVectorBase<double> *dv,
		AbstractFunction<double, double> *af,
		int bIdx);

1554
    /// Implementation of \ref OperatorTerm::initElement().
1555
1556
1557
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

1558
    /// Implements FirstOrderTerm::getLb().
1559
1560
    void getLb(const ElInfo *elInfo, int nPoints, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
1561

1562
    /// Implements FirstOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
1563
1564
    void eval(int nPoints,
	      const double *uhAtQP,
1565
1566
1567
1568
1569
1570
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
1571
    /// DOFVector to be evaluated at quadrature points.
1572
1573
    DOFVectorBase<double>* vec;

1574
    /// v at quadrature points.
1575
1576
    double *vecAtQPs;

1577
    /// Function f.
1578
1579
    AbstractFunction<double, double> *f;

1580
    ///
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
    WorldVector<double> *b;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * Simple_FOT multiplied with \f$ f(\vec{x}) \f$.
   */
  class CoordsAtQP_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1593
1594
1595
    /// Constructor.
    CoordsAtQP_FOT(AbstractFunction<double, WorldVector<double> > *af)
      : FirstOrderTerm(af->getDegree()), g(af) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1596
    {}
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements FistOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1607
    void getLb(const ElInfo *elInfo, int nPoints,VectorOfFixVecs<DimVec<double> >&Lb) const;
1608
1609
1610
1611

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1612
1613
    void eval(int nPoints,
	      const double *uhAtQP,
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
    /** \brief
     * Stores coordinates at quadrature points. Set in \ref initElement().
     */
    WorldVector<double>* coordsAtQPs;

    /** \brief
     * Function avaluated at world coordinates.
     */
    AbstractFunction<double, WorldVector<double> > *g;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * Vector_FOT multiplied with \f$ f(\vec{x}) \f$.
   */
  class VecCoordsAtQP_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1640
1641
1642
1643
    /// Constructor.
    VecCoordsAtQP_FOT(AbstractFunction<double, WorldVector<double> > *af,
		      WorldVector<double> wv)
      : FirstOrderTerm(af->getDegree()), g(af), b(wv)
Thomas Witkowski's avatar
Thomas Witkowski committed
1644
    {}
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements FistOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1655
1656
    void getLb(const ElInfo *elInfo, int nPoints,
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
1657
1658
1659
1660

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1661
1662
    void eval(int nPoints,
	      const double *uhAtQP,
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
    /** \brief
     * Stores coordinates at quadrature points. Set in \ref initElement().
     */
    WorldVector<double>* coordsAtQPs;

    /** \brief
     * Function evaluated at world coordinates.
     */
    AbstractFunction<double, WorldVector<double> > *g;

    /** \brief
     * Coefficient vector.
     */
    WorldVector<double> b;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * First order term: \f$ b(\nabla v(\vec{x})) \cdot \nabla u(\vec{x})\f$.
   */
  class VectorGradient_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1694
    /// Constructor.
1695
    VectorGradient_FOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
1696
		       AbstractFunction<WorldVector<double>, WorldVector<double> > *af);
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements FirstOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1707
1708
    void getLb(const ElInfo *elInfo, int nPoints, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
1709
1710
1711
1712

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1713
1714
    void eval(int nPoints,
	      const double *uhAtQP,
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
    DOFVectorBase<double>* vec;

    /** \brief
     * Function for b.
     */
    AbstractFunction<WorldVector<double>, WorldVector<double> > *f;

    /** \brief
     * Gradient of v at quadrature points.
     */
    WorldVector<double> *gradAtQPs;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * First order term: \f$ b(v(\vec{x})) \cdot \nabla u(\vec{x})\f$.
   */
  class VectorFct_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1743
    /// Constructor.
1744
    VectorFct_FOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
1745
		  AbstractFunction<WorldVector<double>, double> *fct);
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements FirstOrderTerm::getLb().
     */
    void getLb(const ElInfo *elInfo, int qPoint, VectorOfFixVecs<DimVec<double> >& Lb) const; 

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1761
1762
    void eval(int nPoints,
	      const double *uhAtQP,
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
    /** \brief
     * DOFVector to be evaluated at quadrature points.
     */
    DOFVectorBase<double>* vec;

    /** \brief
     * Vector v at quadrature points.
     */
    double *vecAtQPs;

    /** \brief
     * Function for b.
     */
    AbstractFunction<WorldVector<double>, double> *vecFct;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class VecFctAtQP_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1794
1795
1796
    /// Constructor.
    VecFctAtQP_FOT(AbstractFunction<WorldVector<double>, WorldVector<double> > *af)
      : FirstOrderTerm(af->getDegree()), g(af) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1797
    {}
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements FistOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1808
    void getLb(const ElInfo *elInfo, int nPoints,VectorOfFixVecs<DimVec<double> >&Lb) const;
1809
1810
1811
1812

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1813
1814
    void eval(int nPoints,
	      const double *uhAtQP,
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
    /** \brief
     * Stores coordinates at quadrature points. Set in \ref initElement().
     */
    WorldVector<double>* coordsAtQPs;

    /** \brief
     * Function avaluated at world coordinates.
     */
    AbstractFunction<WorldVector<double>, WorldVector<double> > *g;
  };

1832
1833
1834
1835
1836
1837
1838
1839
1840
1841

  /**
   * \ingroup Assembler
   *
   * \brief
   * First order term: \f$ b(v(\vec{x}), \nabla w(\vec{x})) \cdot \nabla u(\vec{x})\f$.
   */
  class VecGrad_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1842
    /// Constructor.
1843
    VecGrad_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
1844
		BinaryAbstractFunction<WorldVector<double>, double, WorldVector<double> > *fct);
1845

Thomas Witkowski's avatar
Thomas Witkowski committed
1846
    /// Implementation of \ref OperatorTerm::initElement().
1847
1848
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
Thomas Witkowski's avatar
Thomas Witkowski committed
1849
1850
1851
1852
1853
1854

    /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes.
    void initElement(const ElInfo* smallElInfo,
		     const ElInfo* largeElInfo,
		     SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
1855
    
Thomas Witkowski's avatar
Thomas Witkowski committed
1856
    /// Implements FirstOrderTerm::getLb().
1857
1858
1859
    void getLb(const ElInfo *elInfo, int qPoint, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const; 
    
Thomas Witkowski's avatar
Thomas Witkowski committed
1860
1861
    /// Implements FirstOrderTerm::eval().
    void eval(int nPoints,
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
	      const double *uhAtQP,
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;
    
  protected:
    /** \brief
     * DOFVector to be evaluated at quadrature points.
     */
    DOFVectorBase<double>* vec1;
    DOFVectorBase<double>* vec2;
    
    /** \brief
     * Vector v at quadrature points.
     */
    double *vecAtQPs;

    WorldVector<double> *gradAtQPs;
    
    /** \brief
     * Function for b.
     */
    BinaryAbstractFunction<WorldVector<double>, double, WorldVector<double> > *vecFct;
  };

Thomas Witkowski's avatar
Thomas Witkowski committed
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912

  /**
   * \ingroup Assembler
   *
   * \brief
   * First order term: \f$ b(\nabla v(\vec{x}), \nabla w(\vec{x})) \cdot \nabla u(\vec{x})\f$.
   */
  class FctGrad2_FOT : public FirstOrderTerm
  {
  public:
    /// Constructor
    FctGrad2_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
		BinaryAbstractFunction<WorldVector<double>, WorldVector<double>, WorldVector<double> > *vecFct_)
      : FirstOrderTerm(vecFct_->getDegree()), vec1(dv1), vec2(dv2), vecFct(vecFct_) 
    {}

    /// Implementation of \ref OperatorTerm::initElement().
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
    
    /// Implements FirstOrderTerm::getLb().
    void getLb(const ElInfo *elInfo, int qPoint, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const; 
    
    /// Implements FirstOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
1913
    void eval(int nPoints,
Thomas Witkowski's avatar
Thomas Witkowski committed
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
	      const double *uhAtQP,
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;
    
  protected:
    /// DOFVector to be evaluated at quadrature points.
    DOFVectorBase<double>* vec1;

    /// DOFVector to be evaluated at quadrature points.
    DOFVectorBase<double>* vec2;
    
    /// Gradient v at quadrature points.
    WorldVector<double> *grad1AtQPs;

    /// Gradient v at quadrature points.
    WorldVector<double> *grad2AtQPs;

    /// Function for b.
    BinaryAbstractFunction<WorldVector<double>, WorldVector<double>, WorldVector<double> > *vecFct;
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
  class Vec2AndGradAtQP_FOT : public FirstOrderTerm
  {
  public:

    Vec2AndGradAtQP_FOT(DOFVectorBase<double> *dv1, 
			DOFVectorBase<double> *dv2,
			TertiaryAbstractFunction<double, double, double, WorldVector<double> > *f_, WorldVector<double> *b_);

    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
    
    void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const;
    
    void eval(int nPoints,
	      const double              *uhAtQP,
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
    DOFVectorBase<double>* vec1;
    DOFVectorBase<double>* vec2;

    double *vec1AtQPs;
    double *vec2AtQPs;  
    WorldVector<double> *gradAtQPs1;

    TertiaryAbstractFunction<double, double, double, WorldVector<double> > *f;
    WorldVector<double> *b;
  };


  class FctVecAtQP_FOT : public FirstOrderTerm
  {
  public:
    FctVecAtQP_FOT(DOFVectorBase<double> *dv,
		   AbstractFunction<double, WorldVector<double> > *f_,
		   WorldVector<double> *b_);
1977
1978
    
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
Thomas Witkowski's avatar
Thomas Witkowski committed
1979
		     Quadrature *quad = NULL);
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
    
    void getLb(const ElInfo *elInfo, int nPoints, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
    
    void eval(int nPoints,
	      const double *uhAtQP,
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;
Thomas Witkowski's avatar
Thomas Witkowski committed
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
    
  protected:
    DOFVectorBase<double>* vec;
    double *vecAtQPs;
    WorldVector<double> *coordsAtQPs;
    AbstractFunction<double, WorldVector<double> > *f;
    WorldVector<double> *b;
  };


  class Vec2AtQP_FOT : public FirstOrderTerm
For faster browsing, not all history is shown. View entire blame