Operator.h 96.8 KB
Newer Older
1001
1002
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1003
    /// Constructor.
1004
    VecMatrixGradientAtQP_SOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
1005
1006
1007
			      BinaryAbstractFunction<WorldMatrix<double>, double, WorldVector<double> > *af,
			      AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divAf,
			      bool symm = false);
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017

    /** \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
1018
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1019
1020
1021
1022

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1023
1024
    void eval(int nPoints,
	      const double *uhAtQP,
1025
1026
1027
1028
1029
1030
1031
1032
	      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
1033
    void weakEval(int nPoints,
1034
1035
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;
Thomas Witkowski's avatar
Thomas Witkowski committed
1036
    
1037
1038
  protected:
    DOFVectorBase<double>* vec;
Thomas Witkowski's avatar
Thomas Witkowski committed
1039
    
1040
1041
1042
1043
1044
    /** \brief
     * Function wich maps \ref gradAtQPs to a double.
     */
    BinaryAbstractFunction<WorldMatrix<double>, 
			   double, WorldVector<double> > *f;
Thomas Witkowski's avatar
Thomas Witkowski committed
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
    
    AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divFct;
    
    /** \brief
     * Pointer to a WorldVector<double> array containing the gradients of the DOFVector
     * at each quadrature point.
     */
    double* vecAtQPs;
    WorldVector<double>* gradAtQPs;
    
    bool symmetric;
  };
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068

  /**
   * \ingroup Assembler
   *
   * \brief
   * 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
1069
    /// Constructor.
1070
1071
    VecGradCoordsAtQP_SOT(DOFVectorBase<double> *dv,
			  TertiaryAbstractFunction<double, double,
Thomas Witkowski's avatar
Thomas Witkowski committed
1072
			  WorldVector<double>, WorldVector<double> > *af);
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082

    /** \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
1083
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1084
1085
1086
1087

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1088
1089
    void eval(int nPoints,
	      const double *uhAtQP,
1090
1091
1092
1093
1094
1095
1096
1097
	      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
1098
    void weakEval(int nPoints,
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
1128
1129
1130
1131
		  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
1132
    /// Constructor.
1133
    VecAndCoordsAtQP_SOT(DOFVectorBase<double> *dv, 
Thomas Witkowski's avatar
Thomas Witkowski committed
1134
			 BinaryAbstractFunction<double, double, WorldVector<double> > *af);
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144

    /** \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
1145
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;    
1146

Thomas Witkowski's avatar
Thomas Witkowski committed
1147
1148
    void eval(int nPoints,
	      const double *uhAtQP,
1149
1150
1151
1152
1153
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

Thomas Witkowski's avatar
Thomas Witkowski committed
1154
    void weakEval(int nPoints,
1155
1156
1157
1158
1159
1160
1161
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
		  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
1189
    /// Constructor.
1190
1191
1192
    MatrixGradientAndCoords_SOT(DOFVectorBase<double> *dv,
				BinaryAbstractFunction<WorldMatrix<double>,
				WorldVector<double> , 
Thomas Witkowski's avatar
Thomas Witkowski committed
1193
				WorldVector<double> > *af,
1194
				AbstractFunction<WorldVector<double>,
Thomas Witkowski's avatar
Thomas Witkowski committed
1195
1196
				WorldMatrix<double> > *divAf,
				bool symm = false);
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206

    /** \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
1207
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1208
1209
1210
1211

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1212
1213
    void eval(int nPoints,
	      const double *uhAtQP,
1214
1215
1216
1217
1218
1219
1220
1221
	      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
1222
    void weakEval(int nPoints,
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
		  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;
  };

  class General_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1254
    /// Constructor.
1255
1256
    General_SOT(std::vector<DOFVectorBase<double>*> vecs,
		std::vector<DOFVectorBase<double>*> grads,
1257
1258
		TertiaryAbstractFunction<WorldMatrix<double>, 
		  WorldVector<double>,
1259
1260
		  std::vector<double>, 
		  std::vector<WorldVector<double> > > *f,
1261
1262
		AbstractFunction<WorldVector<double>, 
		  WorldMatrix<double> > *divFct,
Thomas Witkowski's avatar
Thomas Witkowski committed
1263
		bool symmetric);
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274

    /** \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
1275
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1276
1277
1278
1279

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1280
1281
    void eval(int nPoints,
	      const double *uhAtQP,
1282
1283
1284
1285
1286
1287
1288
1289
	      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
1290
    void weakEval(int nPoints,
1291
1292
1293
1294
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
1295
    std::vector<DOFVectorBase<double>*> vecs_; 
1296

1297
    std::vector<DOFVectorBase<double>*> grads_;
1298
1299
1300

    TertiaryAbstractFunction<WorldMatrix<double>, 
			     WorldVector<double>,
1301
1302
			     std::vector<double>, 
			     std::vector<WorldVector<double> > > *f_;
1303
1304
1305
1306
1307
1308

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

    WorldVector<double> *coordsAtQPs_;

1309
    std::vector<double*> vecsAtQPs_;
1310

1311
    std::vector<WorldVector<double>*> gradsAtQPs_;
1312
1313
1314
1315
1316
1317
1318

    bool symmetric_;
  };

  class GeneralParametric_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1319
    /// Constructor.
1320
1321
    GeneralParametric_SOT(std::vector<DOFVectorBase<double>*> vecs,
			  std::vector<DOFVectorBase<double>*> grads,
1322
1323
1324
			  QuartAbstractFunction<WorldMatrix<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
1325
1326
			  std::vector<double>, 
			  std::vector<WorldVector<double> > > *f,
1327
1328
			  AbstractFunction<WorldVector<double>, 
			  WorldMatrix<double> > *divFct,
Thomas Witkowski's avatar
Thomas Witkowski committed
1329
			  bool symmetric);
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340

    /** \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
1341
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
1342
1343
1344
1345

    /** \brief
     * Implenetation of SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1346
1347
    void eval(int nPoints,
	      const double *uhAtQP,
1348
1349
1350
1351
1352
1353
1354
1355
	      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
1356
    void weakEval(int nPoints,
1357
1358
1359
1360
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;

  protected:
1361
    std::vector<DOFVectorBase<double>*> vecs_; 
1362

1363
    std::vector<DOFVectorBase<double>*> grads_;
1364
1365
1366
1367

    QuartAbstractFunction<WorldMatrix<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
1368
1369
			  std::vector<double>, 
			  std::vector<WorldVector<double> > > *f_;
1370
1371
1372
1373
1374
1375
1376

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

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

1377
    std::vector<double*> vecsAtQPs_;
1378

1379
    std::vector<WorldVector<double>*> gradsAtQPs_;
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397

    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
1398
    /// Constructor.
1399
1400
    FirstOrderTerm(int deg) 
      : OperatorTerm(deg) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1401
    {}
1402
1403
1404
1405

    /** \brief
     * Destructor.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1406
    virtual ~FirstOrderTerm() {}
1407
1408
1409
1410
1411

    /** \brief
     * Evaluation of \f$ \Lambda b \f$.
     */
    virtual void getLb(const ElInfo *elInfo,
Thomas Witkowski's avatar
Thomas Witkowski committed
1412
		       int nPoints, 
1413
1414
1415
1416
1417
		       VectorOfFixVecs<DimVec<double> >& result) const = 0;

    /** \brief
     * Implenetation of FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1418
1419
    void eval(int nPoints,
	      const double *,
1420
1421
1422
1423
1424
1425
1426
1427
	      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
1428
	for (int iq = 0; iq < nPoints; iq++) {
1429
1430
1431
1432
1433
1434
1435
	  double resultQP = 0.0;
	  for (int i = 0; i < dow; i++) {
	    resultQP += grdUhAtQP[iq][i];
	  }
	  result[iq] += resultQP * factor;
	}
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
1436
    }
1437

Thomas Witkowski's avatar
Thomas Witkowski committed
1438
  };
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449

  /**
   * \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
1450
    /// Constructor.
1451
1452
    Simple_FOT() 
      : FirstOrderTerm(0) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1453
    {}
1454
1455
1456
1457
1458

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

Thomas Witkowski's avatar
Thomas Witkowski committed
1464
      for (int iq = 0; iq < nPoints; iq++) {
1465
1466
	l1(Lambda, Lb[iq], 1.0);
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
1467
    }
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
  };

  /**
   * \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
1480
1481
1482
    /// Constructor.
    FactorSimple_FOT(double f) 
      : FirstOrderTerm(0)
1483
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
1484
      factor = NEW double;
1485
      *factor = f;
Thomas Witkowski's avatar
Thomas Witkowski committed
1486
    }
1487

Thomas Witkowski's avatar
Thomas Witkowski committed
1488
    /// Constructor.
1489
    FactorSimple_FOT(double *fptr) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1490
      : FirstOrderTerm(0), factor(fptr) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1491
    {}
1492
1493
1494
1495

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

Thomas Witkowski's avatar
Thomas Witkowski committed
1500
      for (int iq = 0; iq < nPoints; iq++) {
1501
1502
	l1(Lambda, Lb[iq], (*factor));
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
1503
    }
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520

  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
1521
1522
1523
1524
    /// Constructor.
    Vector_FOT(WorldVector<double> wv) 
      : FirstOrderTerm(0), b(wv) 
    {}
1525
1526
1527
1528
1529

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

Thomas Witkowski's avatar
Thomas Witkowski committed
1535
      for (int iq = 0; iq < nPoints; iq++) {
1536
1537
	lb(Lambda, b, Lb[iq], 1.0);
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
1538
    }
1539
1540
1541
1542

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1543
1544
    void eval(int nPoints,
	      const double *,
1545
1546
1547
1548
1549
1550
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *,
	      double *result,
	      double factor) const
    {
      if (grdUhAtQP) {
Thomas Witkowski's avatar
Thomas Witkowski committed
1551
	for(int iq = 0; iq < nPoints; iq++) {
1552
1553
1554
	  result[iq] += b * grdUhAtQP[iq] * factor; 
	}
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
1555
    }
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572

  protected:
    /** \brief
     * Vector which is multiplied with \f$ \nabla u(\vec{x}) \f$
     */
    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
1573
    /// Constructor.
1574
    VecAtQP_FOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
1575
1576
		AbstractFunction<double, double> *af,
		WorldVector<double> *wv);
1577

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

1582
    /// Implements FirstOrderTerm::getLb().
Thomas Witkowski's avatar
Thomas Witkowski committed
1583
    void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const;
1584

1585
    /// Implements FirstOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
1586
1587
    void eval(int nPoints,
	      const double *uhAtQP,
1588
1589
1590
1591
1592
1593
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
1594
    /// DOFVector to be evaluated at quadrature points.
1595
1596
    DOFVectorBase<double>* vec;

1597
    /// v at quadrature points.
1598
1599
    double *vecAtQPs;

1600
    /// Function f.
1601
1602
    AbstractFunction<double, double> *f;

1603
    ///
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
    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
1616
1617
1618
    /// Constructor.
    CoordsAtQP_FOT(AbstractFunction<double, WorldVector<double> > *af)
      : FirstOrderTerm(af->getDegree()), g(af) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1619
    {}
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629

    /** \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
1630
    void getLb(const ElInfo *elInfo, int nPoints,VectorOfFixVecs<DimVec<double> >&Lb) const;
1631
1632
1633
1634

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1635
1636
    void eval(int nPoints,
	      const double *uhAtQP,
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
	      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
1663
1664
1665
1666
    /// 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
1667
    {}
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677

    /** \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
1678
1679
    void getLb(const ElInfo *elInfo, int nPoints,
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
1680
1681
1682
1683

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1684
1685
    void eval(int nPoints,
	      const double *uhAtQP,
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
	      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
1717
    /// Constructor.
1718
    VectorGradient_FOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
1719
		       AbstractFunction<WorldVector<double>, WorldVector<double> > *af);
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729

    /** \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
1730
1731
    void getLb(const ElInfo *elInfo, int nPoints, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
1732
1733
1734
1735

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1736
1737
    void eval(int nPoints,
	      const double *uhAtQP,
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
	      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
1766
    /// Constructor.
1767
    VectorFct_FOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
1768
		  AbstractFunction<WorldVector<double>, double> *fct);
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783

    /** \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
1784
1785
    void eval(int nPoints,
	      const double *uhAtQP,
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
	      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
1817
1818
1819
    /// Constructor.
    VecFctAtQP_FOT(AbstractFunction<WorldVector<double>, WorldVector<double> > *af)
      : FirstOrderTerm(af->getDegree()), g(af) 
Thomas Witkowski's avatar
Thomas Witkowski committed
1820
    {}
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830

    /** \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
1831
    void getLb(const ElInfo *elInfo, int nPoints,VectorOfFixVecs<DimVec<double> >&Lb) const;
1832
1833
1834
1835

    /** \brief
     * Implements FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1836
1837
    void eval(int nPoints,
	      const double *uhAtQP,
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
	      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;
  };

1855
1856
1857
1858
1859
1860
1861
1862
1863
1864

  /**
   * \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
1865
    /// Constructor.
1866
    VecGrad_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
1867
		BinaryAbstractFunction<WorldVector<double>, double, WorldVector<double> > *fct);
1868

Thomas Witkowski's avatar
Thomas Witkowski committed
1869
    /// Implementation of \ref OperatorTerm::initElement().
1870
1871
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
Thomas Witkowski's avatar
Thomas Witkowski committed
1872
1873
1874
1875
1876
1877

    /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes.
    void initElement(const ElInfo* smallElInfo,
		     const ElInfo* largeElInfo,
		     SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
1878
    
Thomas Witkowski's avatar
Thomas Witkowski committed
1879
    /// Implements FirstOrderTerm::getLb().
1880
1881
1882
    void getLb(const ElInfo *elInfo, int qPoint, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const; 
    
Thomas Witkowski's avatar
Thomas Witkowski committed
1883
1884
    /// Implements FirstOrderTerm::eval().
    void eval(int nPoints,
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
	      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;
  };

1911
1912
1913
  class General_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1914
    /// Constructor
1915
1916
    General_FOT(std::vector<DOFVectorBase<double>*> vecs,
		std::vector<DOFVectorBase<double>*> grads,
1917
1918
		TertiaryAbstractFunction<WorldVector<double>, 
		WorldVector<double>,
1919
		std::vector<double>, 
Thomas Witkowski's avatar
Thomas Witkowski committed
1920
		std::vector<WorldVector<double> > > *f);
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931

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

    /** \brief
     * Implements FirstOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1932
    void getLb(const ElInfo *elInfo, int nPoints, 
1933
1934
1935
1936
1937
	       VectorOfFixVecs<DimVec<double> >& result) const;

    /** \brief
     * Implenetation of FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1938
1939
    void eval(int nPoints,
	      const double *uhAtQP,
1940
1941
1942
1943
1944
1945
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
1946
    std::vector<DOFVectorBase<double>*> vecs_; 
1947

1948
    std::vector<DOFVectorBase<double>*> grads_;
1949
1950
1951

    TertiaryAbstractFunction<WorldVector<double>, 
			     WorldVector<double>,
1952
1953
			     std::vector<double>, 
			     std::vector<WorldVector<double> > > *f_;
1954
1955
1956

    WorldVector<double> *coordsAtQPs_;

1957
    std::vector<double*> vecsAtQPs_;
1958

1959
    std::vector<WorldVector<double>*> gradsAtQPs_;
1960
1961
1962
1963
1964
  };

  class GeneralParametric_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
1965
    /// Constructor
1966
1967
    GeneralParametric_FOT(std::vector<DOFVectorBase<double>*> vecs,
			  std::vector<DOFVectorBase<double>*> grads,
1968
1969
1970
			  QuartAbstractFunction<WorldVector<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
1971
			  std::vector<double>, 
Thomas Witkowski's avatar
Thomas Witkowski committed
1972
			  std::vector<WorldVector<double> > > *f);
1973
1974
1975
1976

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1977
    void initElement(const ElInfo*, SubAssembler*,
1978
1979
1980
1981
1982
		     Quadrature *quad= NULL);

    /** \brief
     * Implements FirstOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1983
    void getLb(const ElInfo *elInfo, int nPoints, 
1984
1985
1986
1987
1988
	       VectorOfFixVecs<DimVec<double> >& result) const;

    /** \brief
     * Implenetation of FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
1989
1990
    void eval(int nPoints,
	      const double *uhAtQP,
1991
1992
1993
1994
1995
1996
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

  protected:
1997
    std::vector<DOFVectorBase<double>*> vecs_; 
1998

1999
    std::vector<DOFVectorBase<double>*> grads_;
2000

For faster browsing, not all history is shown. View entire blame