ZeroOrderTerm.h 28.5 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

/** \file ZeroOrderTerm.h */

#ifndef AMDIS_ZERO_ORDER_TERM_H
#define AMDIS_ZERO_ORDER_TERM_H

#include "AMDiS_fwd.h"
#include "OperatorTerm.h"
#include "AbstractFunction.h"

namespace AMDiS {

  /**
   * \ingroup Assembler
   *
   * \brief
   * Describes zero order terms: \f$ cu(\vec{x}) \f$.
   */
  class ZeroOrderTerm : public OperatorTerm
  {
  public:
    /// Constructor.
    ZeroOrderTerm(int deg) : OperatorTerm(deg) {}

    /// Destructor.
    virtual ~ZeroOrderTerm() {}

    /// Evaluates \f$ c \f$
48
    virtual void getC(const ElInfo *elInfo, int nPoints, ElementVector& C) = 0;
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   * Simple zero order term
   */
  class Simple_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    Simple_ZOT(double f = 1.0) : ZeroOrderTerm(0), factor(f) {}

    /// Implements ZeroOrderTerm::getC().
65
    inline void getC(const ElInfo *, int nPoints, ElementVector& C)  
66
67
68
69
70
71
    {
      for (int iq = 0; iq < nPoints; iq++)
	C[iq] += factor; 
    }

    /// Implements ZeroOrderTerm::eval().
72
73
74
75
76
77
    inline void eval( int nPoints,
		      const mtl::dense_vector<double>& uhAtQP,
		      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
		      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
		      mtl::dense_vector<double>& result,
		      double fac)
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
    {
      for (int iq = 0; iq < nPoints; iq++)
	result[iq] += fac * factor * uhAtQP[iq];
    }
 
  protected:
    /// Constant factor of zero order term.
    double factor;
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(v(\vec{x})) u(\vec{x})\f$
   */
  class VecAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    VecAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
100
		AbstractFunction<double, double> *ab = NULL);
101
102
103
104
105
106

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

107
    /// Implementation of \ref OperatorTerm::initElement() for multiple meshes.
108
109
110
111
112
113
    void initElement(const ElInfo* smallElInfo,
		     const ElInfo* largeElInfo,
		     SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /// Implements ZeroOrderTerm::getC().
114
    void getC(const ElInfo *, int nPoints, ElementVector& C);
115
116
117

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
118
119
120
121
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
122
123
124
125
126
127
128
	      double fac);

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

    /// Vector v at quadrature points.
129
    mtl::dense_vector<double> vecAtQPs;
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

    /// Function for c.
    AbstractFunction<double, double> *f;
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(v(\vec{x})) g(w(\vec{x})) u(\vec{x})\f$
   */
  class MultVecAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    MultVecAtQP_ZOT(DOFVectorBase<double> *dv1,
		    DOFVectorBase<double> *dv2,
		    AbstractFunction<double, double> *f1,
		    AbstractFunction<double, double> *f2);

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

    /// Implements ZeroOrderTerm::getC().
156
    void getC(const ElInfo *, int nPoints, ElementVector& C);
157
158
159

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
160
161
162
163
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
164
165
166
167
168
169
170
171
	      double fac);

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

    /// Vector v at quadrature points.
172
173
    mtl::dense_vector<double> vecAtQPs1;
    mtl::dense_vector<double> vecAtQPs2;
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192

    /// Function for c.
    AbstractFunction<double, double> *f1;
    AbstractFunction<double, double> *f2;
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(v(\vec{x}), w(\vec{x})) u(\vec{x})\f$
   */
  class Vec2AtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    Vec2AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
193
		 BinaryAbstractFunction<double, double, double> *f = NULL);
194
195
196
197
198
199
200
201
202
203
204
205

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

    /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes.
    void initElement(const ElInfo* smallElInfo,
		     const ElInfo* largeElInfo,
		     SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /// Implements ZeroOrderTerm::getC().
206
    void getC(const ElInfo *, int nPoints, ElementVector& C);
207
208
209

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
210
211
212
213
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
214
215
216
217
218
219
220
221
222
	      double fac);

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

    /// Values of the first DOFVector at the quadrature points.
223
    mtl::dense_vector<double> vecAtQPs1;
224
    /// Values of the second DOFVector at the quadrature points.
225
    mtl::dense_vector<double> vecAtQPs2;
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244

    /// Function for c.
    BinaryAbstractFunction<double, double, double> *f;
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(v(\vec{x}), w(\vec{x})) u(\vec{x})\f$
   */
  class Vec3AtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    Vec3AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
		 DOFVectorBase<double> *dv3,
245
		 TertiaryAbstractFunction<double, double, double, double> *f = NULL);
246
247
248
249
250
251

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

    /// Implements ZeroOrderTerm::getC().
252
    void getC(const ElInfo *, int nPoints, ElementVector& C);
253
254
255

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
256
257
258
259
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
260
261
262
263
264
265
266
	      double fac);

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

    /// Vectors at quadrature points.
267
    mtl::dense_vector<double> vecAtQPs1, vecAtQPs2, vecAtQPs3;
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290

    /// Function for c.
    TertiaryAbstractFunction<double, double, double, double> *f;
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradientCoords_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    FctGradientCoords_ZOT(DOFVectorBase<double> *dv,
			  BinaryAbstractFunction<double, WorldVector<double>, WorldVector<double> > *f);

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

291
    /// Implements ZeroOrderTerm::getC().
292
    void getC(const ElInfo *elInfo, int nPoints, ElementVector& C);
293
294
295

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
296
297
298
299
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
300
301
302
303
304
305
306
307
	      double fac);

  protected:
    DOFVectorBase<double>* vec;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
308
309
    /// Pointer to a WorldVector<double> array containing the gradients of the
    /// DOFVector at each quadrature point.
310
    mtl::dense_vector<WorldVector<double> > gradAtQPs;
311

Thomas Witkowski's avatar
Thomas Witkowski committed
312
    mtl::dense_vector<WorldVector<double> > coordsAtQPs;
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class VecGradCoordsAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    VecGradCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
			  TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f);

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

    /// Implements ZeroOrderTerm::getC().
332
    void getC(const ElInfo *, int nPoints, ElementVector& C);
333
334
335

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
336
337
338
339
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
340
341
342
343
344
345
346
	      double fac);

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

    /// Vector v at quadrature points.
347
    mtl::dense_vector<double> vecAtQPs;
348
349

    /// Gradient at quadrature points.
350
    mtl::dense_vector<WorldVector<double> > gradAtQPs;
351

Thomas Witkowski's avatar
Thomas Witkowski committed
352
    mtl::dense_vector<WorldVector<double> > coordsAtQPs;
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374

    /// Function for c.
    TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class VecAndCoordsAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    VecAndCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
			 BinaryAbstractFunction<double, double, WorldVector<double> > *f);

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

    /// Implements ZeroOrderTerm::getC().
375
    void getC(const ElInfo *, int nPoints, ElementVector& C);
376
377
378

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
379
380
381
382
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
383
384
385
386
387
388
389
	      double fac);

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

    /// Vector v at quadrature points.
390
    mtl::dense_vector<double> vecAtQPs;
391

Thomas Witkowski's avatar
Thomas Witkowski committed
392
    mtl::dense_vector<WorldVector<double> > coordsAtQPs;
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415

    /// Function for c.
    BinaryAbstractFunction<double, double, WorldVector<double> > *f;
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class Vec2AndGradAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    Vec2AndGradAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
			TertiaryAbstractFunction<double, double, WorldVector<double>, double > *af);

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

    /// Implements ZeroOrderTerm::getC().
416
    void getC(const ElInfo *, int nPoints, ElementVector& C);
417
418
419

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
420
421
422
423
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
424
425
426
427
428
429
430
431
	      double fac);

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

    /// Vector v at quadrature points.
432
    mtl::dense_vector<double> vecAtQPs1, vecAtQPs2;
433
434

    /// Gradient at quadrature points.
435
    mtl::dense_vector<WorldVector<double> > gradAtQPs;
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458

    /// Function for c.
    TertiaryAbstractFunction<double, double, WorldVector<double>, double > *f;
  };


  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradient_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    FctGradient_ZOT(DOFVectorBase<double> *dv,
		    AbstractFunction<double, WorldVector<double> > *f);

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

459
    /// Implements ZeroOrderTerm::getC().
460
    void getC(const ElInfo *elInfo, int nPoints, ElementVector& C);
461
462
463

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
464
465
466
467
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
468
469
470
471
472
	      double fac);

  protected:
    DOFVectorBase<double>* vec;

473
    /// Function which maps \ref gradAtQPs to a double.
474
475
476
477
478
479
    AbstractFunction<double, WorldVector<double> > *f;

    /** \brief
     * Pointer to a WorldVector<double> array containing the gradients of the DOFVector
     * at each quadrature point.
     */
480
    mtl::dense_vector<WorldVector<double> > gradAtQPs;
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501

  };


  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class VecAndGradAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    VecAndGradAtQP_ZOT(DOFVectorBase<double> *dv,
		       BinaryAbstractFunction<double, double, WorldVector<double> > *f);

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

    /// Implements ZeroOrderTerm::getC().
502
    void getC(const ElInfo *, int nPoints, ElementVector& C);
503
504
505

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
506
507
508
509
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
510
511
512
513
514
515
516
	      double fac);

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

    /// Vector v at quadrature points.
517
    mtl::dense_vector<double> vecAtQPs;
518
519

    /// Gradient at quadrature points.
520
    mtl::dense_vector<WorldVector<double> > gradAtQPs;
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539

    /// Function for c.
    BinaryAbstractFunction<double, double, WorldVector<double> > *f;
  };


  class VecAndGradVecAtQP_ZOT : public ZeroOrderTerm 
  { 
  public: 
    /// Constructor. 
    VecAndGradVecAtQP_ZOT(DOFVectorBase<double> *dv, 
			  DOFVectorBase<double> *dGrd,
			  BinaryAbstractFunction<double, double, WorldVector<double> > *f);

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

    /// Implements ZeroOrderTerm::getC().
540
    void getC(const ElInfo *, int nPoints, ElementVector& C);
541
542
543

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
544
545
546
547
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
548
549
550
551
552
553
554
	      double fac);

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

    /// Vector v at quadrature points. 
555
    mtl::dense_vector<double> vecAtQPs; 
556
557
558
559
560

    /// First DOFVector whose gradient is evaluated at quadrature points. 
    DOFVectorBase<double>* vecGrd; 

    /// Gradient of first vector at quadrature points. 
561
    mtl::dense_vector<WorldVector<double> > gradAtQPs;
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581

    /// Function for c. 
    BinaryAbstractFunction<double, double, WorldVector<double> > *f; 
  }; 


  class VecAndGradVec2AtQP_ZOT : public ZeroOrderTerm 
  { 
  public: 
    /// Constructor. 
    VecAndGradVec2AtQP_ZOT(DOFVectorBase<double> *dv, 
			   DOFVectorBase<double> *dGrd1, 
			   DOFVectorBase<double> *dGrd2, 
			   TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *af);

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

    /// Implements ZeroOrderTerm::getC().
582
    void getC(const ElInfo *, int nPoints, ElementVector& C);
583
584
585

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
586
587
588
589
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
590
591
592
593
594
595
596
	      double fac);

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

    /// Vector v at quadrature points. 
597
    mtl::dense_vector<double> vecAtQPs; 
598
599
600
601
602

    /// First DOFVector whose gradient is evaluated at quadrature points. 
    DOFVectorBase<double>* vecGrd1; 

    /// Gradient of first vector at quadrature points. 
603
    mtl::dense_vector<WorldVector<double> > grad1AtQPs;
604
605
606
607
608

    /// Second DOFVector whose gradient is evaluated at quadrature points. 
    DOFVectorBase<double>* vecGrd2; 

    /// Gradient of second vector at quadrature points. 
609
    mtl::dense_vector<WorldVector<double> > grad2AtQPs;
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627

    /// Function for c. 
    TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f; 
  }; 


  class VecOfDOFVecsAtQP_ZOT : public ZeroOrderTerm 
  { 
  public: 
    /// Constructor. 
    VecOfDOFVecsAtQP_ZOT(const std::vector<DOFVectorBase<double>*>& dv, 
			 AbstractFunction<double, std::vector<double> > *f);

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

    /// Implements ZeroOrderTerm::getC().
628
    void getC(const ElInfo *, int nPoints, ElementVector& C);
629
630
631

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
632
633
634
635
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
636
637
638
639
640
641
642
	      double fac);

  protected: 
    /// Vector of DOFVectors to be evaluated at quadrature points. 
    std::vector<DOFVectorBase<double>*> vecs; 

    /// Vectors at quadrature points. 
643
    std::vector<mtl::dense_vector<double> > vecsAtQPs; 
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661

    /// Function for c. 
    AbstractFunction<double, std::vector<double> > *f; 
  }; 


  class VecOfGradientsAtQP_ZOT : public ZeroOrderTerm 
  { 
  public: 
    /// Constructor. 
    VecOfGradientsAtQP_ZOT(const std::vector<DOFVectorBase<double>*>& dv, 
			   AbstractFunction<double, std::vector<WorldVector<double>*> > *af);

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

    /// Implements ZeroOrderTerm::getC().
662
    void getC(const ElInfo *, int nPoints, ElementVector& C);
663
664
665

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
666
667
668
669
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
670
671
672
673
674
675
676
	      double fac);

  protected: 
    /// Vector of DOFVectors to be evaluated at quadrature points. 
    std::vector<DOFVectorBase<double>*> vecs; 

    /// Vectors at quadrature points. 
677
    std::vector<mtl::dense_vector<WorldVector<double> > > gradsAtQPs;
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697

    /// Function for c. 
    AbstractFunction<double, std::vector<WorldVector<double>*> > *f; 
  };


  class VecDivergence_ZOT : public ZeroOrderTerm
  {
  public: 
    /// Constructor. 
    VecDivergence_ZOT(int nComponents,
		      DOFVectorBase<double> *vec0,
		      DOFVectorBase<double> *vec1 = NULL,
		      DOFVectorBase<double> *vec2 = NULL);

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

    /// Implements ZeroOrderTerm::getC().
698
    void getC(const ElInfo *, int nPoints, ElementVector& C);
699
700
701

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
702
703
704
705
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
706
707
708
709
710
711
712
	      double fac);

  protected: 
    /// Vector of DOFVectors to be evaluated at quadrature points. 
    std::vector<DOFVectorBase<double>*> vecs; 

    /// Vectors at quadrature points. 
713
    std::vector<mtl::dense_vector<WorldVector<double> > > gradsAtQPs;
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
  };


  class VecAndVecOfGradientsAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    VecAndVecOfGradientsAtQP_ZOT(DOFVector<double> *v,
				 const std::vector<DOFVector<double>*>& dv,
				 BinaryAbstractFunction<double, double, std::vector<WorldVector<double>*> > *af);

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

    /// Implements ZeroOrderTerm::getC().
730
    void getC(const ElInfo *, int nPoints, ElementVector& C);
731
732
733

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
734
735
736
737
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
738
739
740
741
742
743
744
	      double fac);

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

    /// Vector v at quadrature points.
745
    mtl::dense_vector<double> vecAtQPs;
746
747
748
749
750

    /// Vector of DOFVectors to be evaluated at quadrature points.
    std::vector<DOFVector<double>*> vecs;

    /// Vectors at quadrature points.
751
    std::vector<mtl::dense_vector<WorldVector<double> > > gradsAtQPs;
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767

    /// Function for c.
    BinaryAbstractFunction<double, double, std::vector<WorldVector<double>*> > *f;
  };


  class Vec2AndGrad2AtQP_ZOT : public ZeroOrderTerm
  {
  public:
    Vec2AndGrad2AtQP_ZOT(DOFVectorBase<double> *dv1, 
			 DOFVectorBase<double> *dv2,
			QuartAbstractFunction<double, double, double, WorldVector<double>, WorldVector<double> > *af);

    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

768
    void getC(const ElInfo *, int nPoints, ElementVector& C);
769
770

    void eval(int nPoints,
771
772
773
774
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
775
776
777
778
779
	      double fac);

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

780
    mtl::dense_vector<double> vecAtQPs1, vecAtQPs2;
781

782
    mtl::dense_vector<WorldVector<double> > gradAtQPs1, gradAtQPs2;
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797

    QuartAbstractFunction<double, double, double, WorldVector<double>,WorldVector<double> > *f;
  };


  class Vec2AndGradVecAtQP_ZOT : public ZeroOrderTerm 
  { 
  public: 
    Vec2AndGradVecAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, 
			  DOFVectorBase<double> *dGrd,
			  TertiaryAbstractFunction<double, double, double, WorldVector<double> > *f);

    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

798
    void getC(const ElInfo *, int nPoints, ElementVector& C);
799
800

    void eval(int nPoints,
801
802
803
804
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
805
806
807
	      double fac);

  protected: 
808
    DOFVectorBase<double> *vec1, *vec2;
809
    
810
    mtl::dense_vector<double> vec1AtQPs, vec2AtQPs;
811
812

    DOFVectorBase<double>* vecGrd; 
813

814
    mtl::dense_vector<WorldVector<double> > gradAtQPs;
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832

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


  class General_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    General_ZOT(std::vector<DOFVectorBase<double>*> vecs,
		std::vector<DOFVectorBase<double>*> grads,
		TertiaryAbstractFunction<double, WorldVector<double>, std::vector<double>, std::vector<WorldVector<double> > > *f);

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

    /// Implements ZeroOrderTerm::getC().
833
    void getC(const ElInfo *, int nPoints, ElementVector& C);
834
835
836

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
837
838
839
840
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
841
842
843
844
845
846
847
848
849
850
851
852
	      double fac);

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

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

    TertiaryAbstractFunction<double, 
			     WorldVector<double>,
			     std::vector<double>, 
			     std::vector<WorldVector<double> > > *f_;

Thomas Witkowski's avatar
Thomas Witkowski committed
853
    mtl::dense_vector<WorldVector<double> > coordsAtQPs;
854

855
    std::vector<mtl::dense_vector<double> > vecsAtQPs;
856

857
    std::vector<mtl::dense_vector<WorldVector<double> > > gradsAtQPs_;
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881

    std::vector<double> vecsArg;
    
    std::vector<WorldVector<double> > gradsArg;
  };


  class GeneralParametric_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    GeneralParametric_ZOT(std::vector<DOFVectorBase<double>*> vecs,
			  std::vector<DOFVectorBase<double>*> grads,
			  QuartAbstractFunction<double, 
			  WorldVector<double>,
			  WorldVector<double>,
			  std::vector<double>, 
			  std::vector<WorldVector<double> > > *f);

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

    /// Implements ZeroOrderTerm::getC().
882
    void getC(const ElInfo *, int nPoints, ElementVector& C);
883
884
885

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
886
887
888
889
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
890
891
892
893
894
895
896
897
898
899
900
901
902
	      double fac);

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

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

    QuartAbstractFunction<double, 
			  WorldVector<double>,
			  WorldVector<double>,
			  std::vector<double>, 
			  std::vector<WorldVector<double> > > *f_;

Thomas Witkowski's avatar
Thomas Witkowski committed
903
    mtl::dense_vector<WorldVector<double> > coordsAtQPs;
904
905
906

    WorldVector<double> elementNormal_;

907
    std::vector<mtl::dense_vector<double> > vecsAtQPs;
908

909
    std::vector<mtl::dense_vector<WorldVector<double> > > gradsAtQPs;
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
  };


  /* 
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(\vec{x}) u(\vec{x})\f$
   */
  class CoordsAtQP_ZOT : public ZeroOrderTerm
  {
  public:
    /// Constructor.
    CoordsAtQP_ZOT(AbstractFunction<double, WorldVector<double> > *af)
      : ZeroOrderTerm(af->getDegree()), g(af) 
    {}

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

    /// Implements ZeroOrderTerm::getC().
933
    void getC(const ElInfo *, int nPoints, ElementVector& C);
934
935
936

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
937
938
939
940
	      const mtl::dense_vector<double>& uhAtQP,
	      const mtl::dense_vector<WorldVector<double> >& grdUhAtQP,
	      const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP,
	      mtl::dense_vector<double>& result,
941
942
943
944
	      double fac);

  protected:
    /// Stores coordinates at quadrature points. Set in \ref initElement().
Thomas Witkowski's avatar
Thomas Witkowski committed
945
    mtl::dense_vector<WorldVector<double> > coordsAtQPs;
946
947
948
949
950
951
952

    /// Function for c.
    AbstractFunction<double, WorldVector<double> > *g;
  };
}

#endif