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
2228
2229

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2230
2231
    void eval(int nPoints,
	      const double *uhAtQP,
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
	      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
     * 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:
Thomas Witkowski's avatar
Thomas Witkowski committed
2263
    /// Constructor.
2264
2265
    MultVecAtQP_ZOT(DOFVectorBase<double> *dv1,
		    DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2266
2267
		    AbstractFunction<double, double> *f1,
		    AbstractFunction<double, double> *f2);
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2278
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2279
2280
2281
2282

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2283
2284
    void eval(int nPoints,
	      const double *uhAtQP,
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
	      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
2319
    /// Constructor.
2320
2321
    Vec2AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2322
		 BinaryAbstractFunction<double, double, double> *f);
2323

Thomas Witkowski's avatar
Thomas Witkowski committed
2324
    /// Implementation of \ref OperatorTerm::initElement().
2325
2326
2327
    void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
		     Quadrature *quad = NULL);

Thomas Witkowski's avatar
Thomas Witkowski committed
2328
2329
2330
2331
2332
    /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes.
    void initElement(const ElInfo* smallElInfo,
		     const ElInfo* largeElInfo,
		     SubAssembler* subAssembler,
		     Quadrature *quad = NULL);
2333

Thomas Witkowski's avatar
Thomas Witkowski committed
2334
    /// Implements ZeroOrderTerm::getC().
2335
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
Thomas Witkowski's avatar
Thomas Witkowski committed
2336
2337
2338
2339

    /// Implements ZeroOrderTerm::eval().
    void eval(int nPoints,
	      const double *uhAtQP,
2340
2341
2342
2343
2344
2345
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double fac) const;

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
2346
    /// First DOFVector to be evaluated at quadrature points.
2347
    DOFVectorBase<double>* vec1;
Thomas Witkowski's avatar
Thomas Witkowski committed
2348
    /// Second DOFVector to be evaluated at quadrature points.
2349
2350
    DOFVectorBase<double>* vec2;

Thomas Witkowski's avatar
Thomas Witkowski committed
2351
    /// Values of the first DOFVector at the quadrature points.
2352
    double *vecAtQPs1;
Thomas Witkowski's avatar
Thomas Witkowski committed
2353
    /// Values of the second DOFVector at the quadrature points.
2354
2355
    double *vecAtQPs2;

Thomas Witkowski's avatar
Thomas Witkowski committed
2356
    /// Function for c.
2357
2358
2359
    BinaryAbstractFunction<double, double, double> *f;
  };

2360
2361
2362
2363
2364
2365
2366
2367
2368
2369

  /**
   * \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
2370
    /// Constructor.
2371
2372
2373
    Vec3AtQP_ZOT(DOFVectorBase<double> *dv1,
		 DOFVectorBase<double> *dv2,
		 DOFVectorBase<double> *dv3,
Thomas Witkowski's avatar
Thomas Witkowski committed
2374
		 TertiaryAbstractFunction<double, double, double, double> *f);
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2385
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2386
2387
2388
2389

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2390
    void eval(int nPoints,
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
	      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;
  };

2418
2419
2420
2421
2422
2423
2424
2425
2426
2427

  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradientCoords_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2428
    /// Constructor.
2429
    FctGradientCoords_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2430
			  BinaryAbstractFunction<double, WorldVector<double>, WorldVector<double> > *f);
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440

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

    /** \brief
     * Implements SecondOrderTerm::getC().
     */
2441
    void getC(const ElInfo *elInfo, int nPoints, std::vector<double> &C) const;
2442
2443
2444
2445

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2446
2447
    void eval(int nPoints,
	      const double *uhAtQP,
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
	      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
2479
    /// Constructor.
2480
    VecGradCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2481
			  TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f);
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2492
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2493
2494
2495
2496

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2497
2498
    void eval(int nPoints,
	      const double *uhAtQP,
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
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
	      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
2536
    /// Constructor.
2537
    VecAndCoordsAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2538
			 BinaryAbstractFunction<double, double, WorldVector<double> > *f);
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2549
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2550
2551
2552
2553

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2554
2555
    void eval(int nPoints,
	      const double *uhAtQP,
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
	      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;
  };


2584
2585
2586
2587
2588
2589
2590
2591
  /**
   * \ingroup Assembler
   *
   * \brief
   */
  class Vec2AndGradAtQP_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2592
    /// Constructor.
2593
    Vec2AndGradAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2,
Thomas Witkowski's avatar
Thomas Witkowski committed
2594
			TertiaryAbstractFunction<double, double, WorldVector<double>, double > *af);
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2605
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2606
2607
2608
2609

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2610
2611
    void eval(int nPoints,
	      const double *uhAtQP,
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
	      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;
  };
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650


  /**
   * \ingroup Assembler
   *
   * \brief
   * 
   */
  class FctGradient_ZOT : public ZeroOrderTerm
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
2651
    /// Constructor.
2652
    FctGradient_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2653
		    AbstractFunction<double, WorldVector<double> > *f);
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663

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

    /** \brief
     * Implements SecondOrderTerm::getC().
     */
2664
    void getC(const ElInfo *elInfo, int nPoints, std::vector<double> &C) const;
2665
2666
2667
2668

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2669
2670
    void eval(int nPoints,
	      const double *uhAtQP,
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
	      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
2700
    /// Constructor.
2701
    VecAndGradAtQP_ZOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2702
		       BinaryAbstractFunction<double, double, WorldVector<double> > *f);
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2713
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2714
2715
2716
2717

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2718
2719
    void eval(int nPoints,
	      const double *uhAtQP,
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
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
	      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
2755
    /// Constructor.
2756
    VecAndGradAtQP_SOT(DOFVectorBase<double> *dv,
Thomas Witkowski's avatar
Thomas Witkowski committed
2757
		       BinaryAbstractFunction<double, double, WorldVector<double> > *af);
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768

    /** \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
2769
    inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
2770
2771
2772
2773

    /** \brief
     * Implements SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2774
2775
    void eval(int nPoints,
	      const double *uhAtQP,
2776
2777
2778
2779
2780
2781
2782
2783
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implements SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2784
    void weakEval(int nPoints,
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
		  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
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831

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

    /// Implements SecondOrderTerm::eval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2835
2836
    void eval(int nPoints,
	      const double *uhAtQP,
Thomas Witkowski's avatar
Thomas Witkowski committed
2837
2838
2839
2840
2841
2842
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /// Implements SecondOrderTerm::weakEval().
Thomas Witkowski's avatar
Thomas Witkowski committed
2843
    void weakEval(int nPoints,
Thomas Witkowski's avatar
Thomas Witkowski committed
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
		  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;
  };


2863
2864
2865
2866
2867
2868
2869
2870
2871
  /* 
   * \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
2872
2873
2874
    /// Constructor.
    CoordsAtQP_ZOT(AbstractFunction<double, WorldVector<double> > *af)
      : ZeroOrderTerm(af->getDegree()), g(af) 
Thomas Witkowski's avatar
Thomas Witkowski committed
2875
    {}
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886

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

    /** \brief
     * Implements ZeroOrderTerm::getC().
     */
2887
    void getC(const ElInfo *, int nPoints, std::vector<double> &C) const;
2888
2889
2890
2891

    /** \brief
     * Implements ZeroOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2892
2893
    void eval(int nPoints,
	      const double *uhAtQP,
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
	      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
2922
2923
    /// Constructor.
    CoordsAtQP_IJ_SOT(AbstractFunction<double, WorldVector<double> > *af,
2924
		      int x_i, int x_j) 
Thomas Witkowski's avatar
Thomas Witkowski committed
2925
      : SecondOrderTerm(af->getDegree()), g(af), xi(x_i), xj(x_j)
2926
2927
    {
      setSymmetric(xi == xj);
Thomas Witkowski's avatar
Thomas Witkowski committed
2928
    }
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938

    /** \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
2939
    inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;
2940
2941
2942
2943

    /** \brief
     * Implements SecondOrderTerm::eval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2944
2945
    void eval(int nPoints,
	      const double *uhAtQP,
2946
2947
2948
2949
2950
2951
2952
2953
	      const WorldVector<double> *grdUhAtQP,
	      const WorldMatrix<double> *D2UhAtQP,
	      double *result,
	      double factor) const;

    /** \brief
     * Implements SecondOrderTerm::weakEval().
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
2954
    void weakEval(int nPoints,
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
		  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
2987
2988
2989
    /// Constructor.
    VecAtQP_IJ_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af,
		   int x_i, int x_j);
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999

    /** \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
3000
    void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const;    
For faster browsing, not all history is shown. View entire blame