Operator.h 106 KB
Newer Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
    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
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
    
  protected:
    DOFVectorBase<double>* vec;
    double *vecAtQPs;
    WorldVector<double> *coordsAtQPs;
    AbstractFunction<double, WorldVector<double> > *f;
    WorldVector<double> *b;
  };


  class Vec2AtQP_FOT : public FirstOrderTerm
  {
  public:
    Vec2AtQP_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
		 WorldVector<double> *b_);

2026
2027
2028
2029
    Vec2AtQP_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
		 int bIdx);
    
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
Thomas Witkowski's avatar
Thomas Witkowski committed
2030
		     Quadrature *quad = NULL);
2031
2032
2033
2034
2035
2036
    
    void getLb(const ElInfo *elInfo, int nPoints, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
    
    void eval(int nPoints,
	      const double *uhAtQP,
Thomas Witkowski's avatar
Thomas Witkowski committed
2037
2038
2039
2040
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;
2041
    
Thomas Witkowski's avatar
Thomas Witkowski committed
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
  protected:
    DOFVectorBase<double>* vec1;
    DOFVectorBase<double>* vec2;
    double *vec1AtQPs;
    double *vec2AtQPs;  
    WorldVector<double> *b;
  };


  class Vec3FctAtQP_FOT : public FirstOrderTerm
  {
  public:
2054
2055
2056
    Vec3FctAtQP_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, DOFVectorBase<double> *dv3,
		    BinaryAbstractFunction<double, double, double> *f,
		    WorldVector<double> *b);
Thomas Witkowski's avatar
Thomas Witkowski committed
2057
    
2058
2059
2060
    Vec3FctAtQP_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, DOFVectorBase<double> *dv3,
		    BinaryAbstractFunction<double, double, double> *f,
		    int b);
Thomas Witkowski's avatar
Thomas Witkowski committed
2061
2062
2063
2064
    
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
    
2065
2066
    void getLb(const ElInfo *elInfo, int nPoints, 
	       VectorOfFixVecs<DimVec<double> >& Lb) const;
Thomas Witkowski's avatar
Thomas Witkowski committed
2067
2068
    
    void eval(int nPoints,
2069
	      const double *uhAtQP,
Thomas Witkowski's avatar
Thomas Witkowski committed
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;
    
  protected:
    DOFVectorBase<double>* vec1;
    DOFVectorBase<double>* vec2;
    DOFVectorBase<double>* vec3;
    BinaryAbstractFunction<double, double, double>* f;
    double *vec1AtQPs;
    double *vec2AtQPs;  
    double *vec3AtQPs;  
    WorldVector<double> *b;
  };


2087
2088
2089
  class General_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2090
    /// Constructor
2091
2092
    General_FOT(std::vector<DOFVectorBase<double>*> vecs,
		std::vector<DOFVectorBase<double>*> grads,
2093
2094
		TertiaryAbstractFunction<WorldVector<double>, 
		WorldVector<double>,
2095
		std::vector<double>, 
Thomas Witkowski's avatar
Thomas Witkowski committed
2096
		std::vector<WorldVector<double> > > *f);
2097

Thomas Witkowski's avatar
Thomas Witkowski committed
2098
    /// Implementation of \ref OperatorTerm::initElement().
2099
2100
2101
2102
    void initElement(const ElInfo*, 
		     SubAssembler* ,
		     Quadrature *quad= NULL);

Thomas Witkowski's avatar
Thomas Witkowski committed
2103
    /// Implements FirstOrderTerm::getLb().
Thomas Witkowski's avatar
Thomas Witkowski committed
2104
    void getLb(const ElInfo *elInfo, int nPoints, 
2105
2106
	       VectorOfFixVecs<DimVec<double> >& result) const;

Thomas Witkowski's avatar
Thomas Witkowski committed
2107
    /// Implenetation of FirstOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2108
2109
    void eval(int nPoints,
	      const double *uhAtQP,
2110
2111
2112
2113
2114
2115
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

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

2118
    std::vector<DOFVectorBase<double>*> grads_;
2119
2120
2121

    TertiaryAbstractFunction<WorldVector<double>, 
			     WorldVector<double>,
2122
2123
			     std::vector<double>, 
			     std::vector<WorldVector<double> > > *f_;
2124
2125
2126

    WorldVector<double> *coordsAtQPs_;

2127
    std::vector<double*> vecsAtQPs_;
2128

2129
    std::vector<WorldVector<double>*> gradsAtQPs_;
2130
2131
2132
2133
2134
  };

  class GeneralParametric_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2135
    /// Constructor
2136
2137
    GeneralParametric_FOT(std::vector<DOFVectorBase<double>*> vecs,
			  std::vector<DOFVectorBase<double>*> grads,
2138
2139
2140
			  QuartAbstractFunction<WorldVector<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
2141
			  std::vector<double>, 
Thomas Witkowski's avatar
Thomas Witkowski committed
2142
			  std::vector<WorldVector<double> > > *f);
2143
2144
2145
2146

    /** \brief
     * Implementation of \ref OperatorTerm::initElement().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2147
    void initElement(const ElInfo*, SubAssembler*,
2148
2149
2150
2151
2152
		     Quadrature *quad= NULL);

    /** \brief
     * Implements FirstOrderTerm::getLb().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2153
    void getLb(const ElInfo *elInfo, int nPoints, 
2154
2155
2156
2157
2158
	       VectorOfFixVecs<DimVec<double> >& result) const;

    /** \brief
     * Implenetation of FirstOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2159
2160
    void eval(int nPoints,
	      const double *uhAtQP,
2161
2162
2163
2164
2165
2166
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

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

2169
    std::vector<DOFVectorBase<double>*> grads_;
2170
2171
2172
2173

    QuartAbstractFunction<WorldVector<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
2174
2175
			  std::vector<double>, 
			  std::vector<WorldVector<double> > > *f_;
2176
2177
2178
2179

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

2180
    std::vector<double*> vecsAtQPs_;
2181

2182
    std::vector<WorldVector<double>*> gradsAtQPs_;
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
  };


  // ============================================================================
  // ===== class ZeroOrderTerm ==================================================
  // ============================================================================

  /**
   * \ingroup Assembler
   *
   * \brief
   * Describes zero order terms: \f$ cu(\vec{x}) \f$.
   */
  class ZeroOrderTerm : public OperatorTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2199
    /// Constructor.
Thomas Witkowski's avatar
Thomas Witkowski committed
2200
    ZeroOrderTerm(int deg) : OperatorTerm(deg) {}
2201
2202
2203
2204

    /** \brief
     * Destructor.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2205
    virtual ~ZeroOrderTerm() {}
2206
2207
2208
2209
2210

    /** \brief
     * Evaluates \f$ c \f$
     */
    virtual void getC(const ElInfo *elInfo,
Thomas Witkowski's avatar
Thomas Witkowski committed
2211
		      int nPoints,
2212
		      std::vector<double> &C) const = 0;
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224

  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * Simple zero order term
   */
  class Simple_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2225
    /// Constructor.
Thomas Witkowski's avatar
Thomas Witkowski committed
2226
    Simple_ZOT(double f = 1.0) : ZeroOrderTerm(0), factor(f) {}
2227

2228
2229
    /// Implements ZeroOrderTerm::getC().
    inline void getC(const ElInfo *, int nPoints, std::vector<double> &C) const 
2230
    {
2231
      for (int iq = 0; iq < nPoints; iq++)
2232
	C[iq] += factor; 
Thomas Witkowski's avatar
Thomas Witkowski committed
2233
    }
2234

Thomas Witkowski's avatar
Thomas Witkowski committed
2235
    /// Implements ZeroOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2236
2237
    inline void eval(int nPoints,
		     const double *uhAtQP,
2238
2239
2240
2241
2242
		     const WorldVector<double> *,
		     const WorldMatrix<double> *,
		     double *result,
		     double fac) const 
    {
2243
      for (int iq = 0; iq < nPoints; iq++)
2244
	result[iq] += fac * factor * uhAtQP[iq];
Thomas Witkowski's avatar
Thomas Witkowski committed
2245
    }
2246
2247
 
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
2248
    /// Constant factor of zero order term.
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
    double factor;
  };

  /**
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(v(\vec{x})) u(\vec{x})\f$
   */
  class VecAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2261
    /// Constructor.
2262
    VecAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2263
		AbstractFunction<double, double> *ab);
2264

Thomas Witkowski's avatar
Thomas Witkowski committed
2265
2266
2267
2268
2269
2270
2271
2272
2273
    /// 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,
2274
2275
		     Quadrature *quad = NULL);

2276
2277
    /// Implements ZeroOrderTerm::getC().
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2278

2279
    /// Implements ZeroOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2280
2281
    void eval(int nPoints,
	      const double *uhAtQP,
2282
2283
2284
2285
2286
2287
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

2291
    /// Vector v at quadrature points.
2292
2293
    double *vecAtQPs;

2294
    /// Function for c.
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
    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:
Thomas Witkowski's avatar
Thomas Witkowski committed
2307
    /// Constructor.
2308
2309
    MultVecAtQP_ZOT(DOFVectorBase<double> *dv1,
		    DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2310
2311
		    AbstractFunction<double, double> *f1,
		    AbstractFunction<double, double> *f2);
2312

2313
    /// Implementation of \ref OperatorTerm::initElement().
2314
2315
2316
2317
2318
2319
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2320
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2321
2322
2323
2324

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2325
2326
    void eval(int nPoints,
	      const double *uhAtQP,
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

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

    /** \brief
     * 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:
Thomas Witkowski's avatar
Thomas Witkowski committed
2361
    /// Constructor.
2362
2363
    Vec2AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2364
		 BinaryAbstractFunction<double, double, double> *f);
2365

Thomas Witkowski's avatar
Thomas Witkowski committed
2366
    /// Implementation of \ref OperatorTerm::initElement().
2367
2368
2369
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

Thomas Witkowski's avatar
Thomas Witkowski committed
2370
2371
2372
2373
2374
    /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes.
    void initElement(const ElInfo* smallElInfo,
		     const ElInfo* largeElInfo,
		     SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
2375

Thomas Witkowski's avatar
Thomas Witkowski committed
2376
    /// Implements ZeroOrderTerm::getC().
2377
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
Thomas Witkowski's avatar
Thomas Witkowski committed
2378
2379
2380
2381

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
	      const double *uhAtQP,
2382
2383
2384
2385
2386
2387
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
2388
    /// First DOFVector to be evaluated at quadrature points.
2389
    DOFVectorBase<double>* vec1;
Thomas Witkowski's avatar
Thomas Witkowski committed
2390
    /// Second DOFVector to be evaluated at quadrature points.
2391
2392
    DOFVectorBase<double>* vec2;

Thomas Witkowski's avatar
Thomas Witkowski committed
2393
    /// Values of the first DOFVector at the quadrature points.
2394
    double *vecAtQPs1;
Thomas Witkowski's avatar
Thomas Witkowski committed
2395
    /// Values of the second DOFVector at the quadrature points.
2396
2397
    double *vecAtQPs2;

Thomas Witkowski's avatar
Thomas Witkowski committed
2398
    /// Function for c.
2399
2400
2401
    BinaryAbstractFunction<double, double, double> *f;
  };

2402
2403
2404
2405
2406
2407
2408
2409
2410
2411

  /**
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(v(\vec{x}), w(\vec{x})) u(\vec{x})\f$
   */
  class Vec3AtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2412
    /// Constructor.
2413
2414
2415
    Vec3AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
		 DOFVectorBase<double> *dv3,
Thomas Witkowski's avatar
Thomas Witkowski committed
2416
		 TertiaryAbstractFunction<double, double, double, double> *f);
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2427
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2428
2429
2430
2431

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2432
    void eval(int nPoints,
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
	      const double *uhAtQP,
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

    /** \brief
     * Vector v at quadrature points.
     */
    double *vecAtQPs1;
    double *vecAtQPs2;
    double *vecAtQPs3;

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

2460
2461
2462
2463
2464
2465
2466
2467
2468
2469

  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradientCoords_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2470
    /// Constructor.
2471
    FctGradientCoords_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2472
			  BinaryAbstractFunction<double, WorldVector<double>, WorldVector<double> > *f);
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482

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

    /** \brief
     * Implements SecondOrderTerm::getC().
     */
2483
    void getC(const ElInfo *elInfo, int nPoints, std::vector<double> &C) const;
2484
2485
2486
2487

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2488
2489
    void eval(int nPoints,
	      const double *uhAtQP,
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

  protected:
    DOFVectorBase<double>* vec;

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

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

    WorldVector<double>* coordsAtQPs;

  };

  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class VecGradCoordsAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2521
    /// Constructor.
2522
    VecGradCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2523
			  TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f);
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2534
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2535
2536
2537
2538

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2539
2540
    void eval(int nPoints,
	      const double *uhAtQP,
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

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

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

    WorldVector<double>* coordsAtQPs;

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

  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class VecAndCoordsAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2578
    /// Constructor.
2579
    VecAndCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2580
			 BinaryAbstractFunction<double, double, WorldVector<double> > *f);
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2591
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2592
2593
2594
2595

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2596
2597
    void eval(int nPoints,
	      const double *uhAtQP,
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

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

    /** \brief
     * Gradient at quadrature points.
     */
    WorldVector<double>* coordsAtQPs;

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


2626
2627
2628
2629
2630
2631
2632
2633
  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class Vec2AndGradAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2634
    /// Constructor.
2635
    Vec2AndGradAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2636
			TertiaryAbstractFunction<double, double, WorldVector<double>, double > *af);
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2647
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2648
2649
2650
2651

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2652
2653
    void eval(int nPoints,
	      const double *uhAtQP,
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

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

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

    /** \brief
     * Function for c.
     */
    TertiaryAbstractFunction<double, double, WorldVector<double>, double > *f;
  };
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692


  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradient_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2693
    /// Constructor.
2694
    FctGradient_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2695
		    AbstractFunction<double, WorldVector<double> > *f);
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705

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

    /** \brief
     * Implements SecondOrderTerm::getC().
     */
2706
    void getC(const ElInfo *elInfo, int nPoints, std::vector<double> &C) const;
2707
2708
2709
2710

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2711
2712
    void eval(int nPoints,
	      const double *uhAtQP,
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

  protected:
    DOFVectorBase<double>* vec;

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

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

  };

  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class VecAndGradAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2742
    /// Constructor.
2743
    VecAndGradAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2744
		       BinaryAbstractFunction<double, double, WorldVector<double> > *f);
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2755
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2756
2757
2758
2759

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2760
2761
    void eval(int nPoints,
	      const double *uhAtQP,
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

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

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

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

  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class VecAndGradAtQP_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2797
    /// Constructor.
2798
    VecAndGradAtQP_SOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2799
		       BinaryAbstractFunction<double, double, WorldVector<double> > *af);
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810

    /** \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
2811
    inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
2812
2813
2814
2815

    /** \brief
     * Implements SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2816
2817
    void eval(int nPoints,
	      const double *uhAtQP,
2818
2819
2820
2821
2822
2823
2824
2825
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implements SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2826
    void weakEval(int nPoints,
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;
  
  protected:
    /** \brief
     * DOFVector to be evaluated at quadrature points.
     */
    DOFVectorBase<double>* vec;

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873

  /**
   * \ingroup Assembler
   *
   * \brief
   * Second order term: \f$ f(v(\vec{x}),\nabla w(\vec{x})) \Delta u(\vec{x})\f$
   */
  class VecGrad_SOT : public SecondOrderTerm
  {
  public:
    /// Constructor.
    VecGrad_SOT( DOFVectorBase<double> *dv1,
			  DOFVectorBase<double> *dv2,
		       BinaryAbstractFunction<double, double, WorldVector<double> > *f_)
      : SecondOrderTerm(f_->getDegree()), vec1(dv1), vec2(dv2), f(f_) 
    {}

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

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

    /// Implements SecondOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2877
2878
    void eval(int nPoints,
	      const double *uhAtQP,
Thomas Witkowski's avatar
Thomas Witkowski committed
2879
2880
2881
2882
2883
2884
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /// Implements SecondOrderTerm::weakEval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2885
    void weakEval(int nPoints,
Thomas Witkowski's avatar
Thomas Witkowski committed
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;
  
  protected:
    /// DOFVectors to be evaluated at quadrature points.
    DOFVectorBase<double>* vec1;
    DOFVectorBase<double>* vec2;

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

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

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


2905
2906
2907
2908
2909
2910
2911
2912
2913
  /* 
   * \ingroup Assembler
   *
   * \brief
   * Zero order term: \f$ f(\vec{x}) u(\vec{x})\f$
   */
  class CoordsAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2914
2915
2916
    /// Constructor.
    CoordsAtQP_ZOT(AbstractFunction<double, WorldVector<double> > *af)
      : ZeroOrderTerm(af->getDegree()), g(af) 
Thomas Witkowski's avatar
Thomas Witkowski committed
2917
    {}
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2929
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2930
2931
2932
2933

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2934
2935
    void eval(int nPoints,
	      const double *uhAtQP,
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

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

  /** 
   * \ingroup Assembler
   *
   * \brief
   * SecondOrderTerm where A(x) is a WorldMatrix having a in all positions
   * except possibly the position IJ
   * \f$ \nabla \cdot A(x) \nabla u(\vec{x}) \f$
   */
  class CoordsAtQP_IJ_SOT : public SecondOrderTerm 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2964
2965
    /// Constructor.
    CoordsAtQP_IJ_SOT(AbstractFunction<double, WorldVector<double> > *af,
2966
		      int x_i, int x_j) 
Thomas Witkowski's avatar
Thomas Witkowski committed
2967
      : SecondOrderTerm(af->getDegree()), g(af), xi(x_i), xj(x_j)
2968
2969
    {
      setSymmetric(xi == xj);
Thomas Witkowski's avatar
Thomas Witkowski committed
2970
    }
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980

    /** \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
2981
    inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
2982
2983
2984
2985

    /** \brief
     * Implements SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2986
2987
    void eval(int nPoints,
	      const double *uhAtQP,
2988
2989
2990
2991
2992
2993
2994
2995
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implements SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2996
    void weakEval(int nPoints,
2997
2998
2999
3000
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;
  
  private:
For faster browsing, not all history is shown. View entire blame