Operator.h 104 KB
Newer Older
Thomas Witkowski's avatar
Thomas Witkowski committed
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034


  class Vec3FctAtQP_FOT : public FirstOrderTerm
  {
  public:
    
    Vec3FctAtQP_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,DOFVectorBase<double> *dv3,
		    BinaryAbstractFunction<double, double, double> *f_,
		    WorldVector<double> *b_);
    
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
    
    void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const;
    
    void eval(int nPoints,
	      const double              *uhAtQP,
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;
    
  protected:
    DOFVectorBase<double>* vec1;
    DOFVectorBase<double>* vec2;
    DOFVectorBase<double>* vec3;
    BinaryAbstractFunction<double, double, double>* f;
    double *vec1AtQPs;
    double *vec2AtQPs;  
    double *vec3AtQPs;  
    WorldVector<double> *b;
  };


2035
2036
2037
  class General_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2038
    /// Constructor
2039
2040
    General_FOT(std::vector<DOFVectorBase<double>*> vecs,
		std::vector<DOFVectorBase<double>*> grads,
2041
2042
		TertiaryAbstractFunction<WorldVector<double>, 
		WorldVector<double>,
2043
		std::vector<double>, 
Thomas Witkowski's avatar
Thomas Witkowski committed
2044
		std::vector<WorldVector<double> > > *f);
2045

Thomas Witkowski's avatar
Thomas Witkowski committed
2046
    /// Implementation of \ref OperatorTerm::initElement().
2047
2048
2049
2050
    void initElement(const ElInfo*, 
		     SubAssembler* ,
		     Quadrature *quad= NULL);

Thomas Witkowski's avatar
Thomas Witkowski committed
2051
    /// Implements FirstOrderTerm::getLb().
Thomas Witkowski's avatar
Thomas Witkowski committed
2052
    void getLb(const ElInfo *elInfo, int nPoints, 
2053
2054
	       VectorOfFixVecs<DimVec<double> >& result) const;

Thomas Witkowski's avatar
Thomas Witkowski committed
2055
    /// Implenetation of FirstOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2056
2057
    void eval(int nPoints,
	      const double *uhAtQP,
2058
2059
2060
2061
2062
2063
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

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

2066
    std::vector<DOFVectorBase<double>*> grads_;
2067
2068
2069

    TertiaryAbstractFunction<WorldVector<double>, 
			     WorldVector<double>,
2070
2071
			     std::vector<double>, 
			     std::vector<WorldVector<double> > > *f_;
2072
2073
2074

    WorldVector<double> *coordsAtQPs_;

2075
    std::vector<double*> vecsAtQPs_;
2076

2077
    std::vector<WorldVector<double>*> gradsAtQPs_;
2078
2079
2080
2081
2082
  };

  class GeneralParametric_FOT : public FirstOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2083
    /// Constructor
2084
2085
    GeneralParametric_FOT(std::vector<DOFVectorBase<double>*> vecs,
			  std::vector<DOFVectorBase<double>*> grads,
2086
2087
2088
			  QuartAbstractFunction<WorldVector<double>, 
			  WorldVector<double>,
			  WorldVector<double>,
2089
			  std::vector<double>, 
Thomas Witkowski's avatar
Thomas Witkowski committed
2090
			  std::vector<WorldVector<double> > > *f);
2091
2092
2093
2094

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

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

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

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

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

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

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

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

2130
    std::vector<WorldVector<double>*> gradsAtQPs_;
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
  };


  // ============================================================================
  // ===== 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
2147
    /// Constructor.
Thomas Witkowski's avatar
Thomas Witkowski committed
2148
    ZeroOrderTerm(int deg) : OperatorTerm(deg) {}
2149
2150
2151
2152

    /** \brief
     * Destructor.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2153
    virtual ~ZeroOrderTerm() {}
2154
2155
2156
2157
2158

    /** \brief
     * Evaluates \f$ c \f$
     */
    virtual void getC(const ElInfo *elInfo,
Thomas Witkowski's avatar
Thomas Witkowski committed
2159
		      int nPoints,
2160
		      std::vector<double> &C) const = 0;
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172

  };

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

2176
2177
    /// Implements ZeroOrderTerm::getC().
    inline void getC(const ElInfo *, int nPoints, std::vector<double> &C) const 
2178
    {
2179
      for (int iq = 0; iq < nPoints; iq++)
2180
	C[iq] += factor; 
Thomas Witkowski's avatar
Thomas Witkowski committed
2181
    }
2182

Thomas Witkowski's avatar
Thomas Witkowski committed
2183
    /// Implements ZeroOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2184
2185
    inline void eval(int nPoints,
		     const double *uhAtQP,
2186
2187
2188
2189
2190
		     const WorldVector<double> *,
		     const WorldMatrix<double> *,
		     double *result,
		     double fac) const 
    {
2191
      for (int iq = 0; iq < nPoints; iq++)
2192
	result[iq] += fac * factor * uhAtQP[iq];
Thomas Witkowski's avatar
Thomas Witkowski committed
2193
    }
2194
2195
 
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
2196
    /// Constant factor of zero order term.
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
    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
2209
    /// Constructor.
2210
    VecAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2211
		AbstractFunction<double, double> *ab);
2212

Thomas Witkowski's avatar
Thomas Witkowski committed
2213
2214
2215
2216
2217
2218
2219
2220
2221
    /// 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,
2222
2223
		     Quadrature *quad = NULL);

2224
2225
    /// Implements ZeroOrderTerm::getC().
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2226

2227
    /// Implements ZeroOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2228
2229
    void eval(int nPoints,
	      const double *uhAtQP,
2230
2231
2232
2233
2234
2235
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

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

2239
    /// Vector v at quadrature points.
2240
2241
    double *vecAtQPs;

2242
    /// Function for c.
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
    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
2255
    /// Constructor.
2256
2257
    MultVecAtQP_ZOT(DOFVectorBase<double> *dv1,
		    DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2258
2259
		    AbstractFunction<double, double> *f1,
		    AbstractFunction<double, double> *f2);
2260

2261
    /// Implementation of \ref OperatorTerm::initElement().
2262
2263
2264
2265
2266
2267
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2268
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2269
2270
2271
2272

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2273
2274
    void eval(int nPoints,
	      const double *uhAtQP,
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
	      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
2309
    /// Constructor.
2310
2311
    Vec2AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2312
		 BinaryAbstractFunction<double, double, double> *f);
2313

Thomas Witkowski's avatar
Thomas Witkowski committed
2314
    /// Implementation of \ref OperatorTerm::initElement().
2315
2316
2317
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

Thomas Witkowski's avatar
Thomas Witkowski committed
2318
2319
2320
2321
2322
    /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes.
    void initElement(const ElInfo* smallElInfo,
		     const ElInfo* largeElInfo,
		     SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
2323

Thomas Witkowski's avatar
Thomas Witkowski committed
2324
    /// Implements ZeroOrderTerm::getC().
2325
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
Thomas Witkowski's avatar
Thomas Witkowski committed
2326
2327
2328
2329

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
	      const double *uhAtQP,
2330
2331
2332
2333
2334
2335
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
2336
    /// First DOFVector to be evaluated at quadrature points.
2337
    DOFVectorBase<double>* vec1;
Thomas Witkowski's avatar
Thomas Witkowski committed
2338
    /// Second DOFVector to be evaluated at quadrature points.
2339
2340
    DOFVectorBase<double>* vec2;

Thomas Witkowski's avatar
Thomas Witkowski committed
2341
    /// Values of the first DOFVector at the quadrature points.
2342
    double *vecAtQPs1;
Thomas Witkowski's avatar
Thomas Witkowski committed
2343
    /// Values of the second DOFVector at the quadrature points.
2344
2345
    double *vecAtQPs2;

Thomas Witkowski's avatar
Thomas Witkowski committed
2346
    /// Function for c.
2347
2348
2349
    BinaryAbstractFunction<double, double, double> *f;
  };

2350
2351
2352
2353
2354
2355
2356
2357
2358
2359

  /**
   * \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
2360
    /// Constructor.
2361
2362
2363
    Vec3AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
		 DOFVectorBase<double> *dv3,
Thomas Witkowski's avatar
Thomas Witkowski committed
2364
		 TertiaryAbstractFunction<double, double, double, double> *f);
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2375
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2376
2377
2378
2379

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2380
    void eval(int nPoints,
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
	      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;
  };

2408
2409
2410
2411
2412
2413
2414
2415
2416
2417

  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradientCoords_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2418
    /// Constructor.
2419
    FctGradientCoords_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2420
			  BinaryAbstractFunction<double, WorldVector<double>, WorldVector<double> > *f);
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430

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

    /** \brief
     * Implements SecondOrderTerm::getC().
     */
2431
    void getC(const ElInfo *elInfo, int nPoints, std::vector<double> &C) const;
2432
2433
2434
2435

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2436
2437
    void eval(int nPoints,
	      const double *uhAtQP,
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
	      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
2469
    /// Constructor.
2470
    VecGradCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2471
			  TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f);
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481

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

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

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2487
2488
    void eval(int nPoints,
	      const double *uhAtQP,
2489
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
2521
2522
2523
2524
2525
	      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
2526
    /// Constructor.
2527
    VecAndCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2528
			 BinaryAbstractFunction<double, double, WorldVector<double> > *f);
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2539
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2540
2541
2542
2543

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2544
2545
    void eval(int nPoints,
	      const double *uhAtQP,
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
	      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;
  };


2574
2575
2576
2577
2578
2579
2580
2581
  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class Vec2AndGradAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2582
    /// Constructor.
2583
    Vec2AndGradAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2584
			TertiaryAbstractFunction<double, double, WorldVector<double>, double > *af);
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2595
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2596
2597
2598
2599

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2600
2601
    void eval(int nPoints,
	      const double *uhAtQP,
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
	      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;
  };
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640


  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradient_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2641
    /// Constructor.
2642
    FctGradient_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2643
		    AbstractFunction<double, WorldVector<double> > *f);
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653

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

    /** \brief
     * Implements SecondOrderTerm::getC().
     */
2654
    void getC(const ElInfo *elInfo, int nPoints, std::vector<double> &C) const;
2655
2656
2657
2658

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2659
2660
    void eval(int nPoints,
	      const double *uhAtQP,
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
	      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
2690
    /// Constructor.
2691
    VecAndGradAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2692
		       BinaryAbstractFunction<double, double, WorldVector<double> > *f);
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2703
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2704
2705
2706
2707

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2708
2709
    void eval(int nPoints,
	      const double *uhAtQP,
2710
2711
2712
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
2742
2743
2744
	      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
2745
    /// Constructor.
2746
    VecAndGradAtQP_SOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2747
		       BinaryAbstractFunction<double, double, WorldVector<double> > *af);
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758

    /** \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
2759
    inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
2760
2761
2762
2763

    /** \brief
     * Implements SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2764
2765
    void eval(int nPoints,
	      const double *uhAtQP,
2766
2767
2768
2769
2770
2771
2772
2773
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implements SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2774
    void weakEval(int nPoints,
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
		  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
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821

  /**
   * \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
2822
    inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
Thomas Witkowski's avatar
Thomas Witkowski committed
2823
2824

    /// Implements SecondOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2825
2826
    void eval(int nPoints,
	      const double *uhAtQP,
Thomas Witkowski's avatar
Thomas Witkowski committed
2827
2828
2829
2830
2831
2832
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /// Implements SecondOrderTerm::weakEval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2833
    void weakEval(int nPoints,
Thomas Witkowski's avatar
Thomas Witkowski committed
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
		  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;
  };


2853
2854
2855
2856
2857
2858
2859
2860
2861
  /* 
   * \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
2862
2863
2864
    /// Constructor.
    CoordsAtQP_ZOT(AbstractFunction<double, WorldVector<double> > *af)
      : ZeroOrderTerm(af->getDegree()), g(af) 
Thomas Witkowski's avatar
Thomas Witkowski committed
2865
    {}
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2877
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2878
2879
2880
2881

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2882
2883
    void eval(int nPoints,
	      const double *uhAtQP,
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
	      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
2912
2913
    /// Constructor.
    CoordsAtQP_IJ_SOT(AbstractFunction<double, WorldVector<double> > *af,
2914
		      int x_i, int x_j) 
Thomas Witkowski's avatar
Thomas Witkowski committed
2915
      : SecondOrderTerm(af->getDegree()), g(af), xi(x_i), xj(x_j)
2916
2917
    {
      setSymmetric(xi == xj);
Thomas Witkowski's avatar
Thomas Witkowski committed
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 SecondOrderTerm::getLALt().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2929
    inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
2930
2931
2932
2933

    /** \brief
     * Implements SecondOrderTerm::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
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implements SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2944
    void weakEval(int nPoints,
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
		  const WorldVector<double> *grdUhAtQP,
		  WorldVector<double> *result) const;
  
  private:
    /** \brief
     * Stores coordinates at quadrature points. Set in \ref initElement().
     */
    WorldVector<double>* coordsAtQPs;

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

    /** \brief
     * Directions for the derivatives.
     */
    int xi, xj;
  };

  /**
   * \ingroup Assembler
   *  
   * \brief
   * SecondOrderTerm where A is a WorldMatrix having a in all positions
   * except possibly the position IJ, multiplied with a function
   * evaluated at the quadrature points of a given DOFVector:
   * \f$ \nabla \cdot f(v(\vec{x})) A \nabla u(\vec{x}) \f$
   */
  class VecAtQP_IJ_SOT : public SecondOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2977
2978
2979
    /// Constructor.
    VecAtQP_IJ_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af,
		   int x_i, int x_j);
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989

    /** \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
2990
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;    
2991
2992
2993
2994

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