Index

NAME

FieldsPiWisConst - vector field corresponding to FieldPiWisConst


INCLUDE

include "FieldPiWisConst.h"

SYNTAX

 class FieldsPiWisConst : public FieldsWithPtValues
 {
 protected:
   VecSimplest(Handle(FieldPiWisConst)) sdsfvec;

 public:
   FieldsPiWisConst ();
   FieldsPiWisConst (int n, const char* fieldname);
   FieldsPiWisConst
     (const GridFE& grid, bool elementsRsubdomains, const char* fieldname);
   FieldsPiWisConst
     (int nfields, const GridFE& grid, bool elementsRsubdomains,
      const char* fieldname);
  ~FieldsPiWisConst ();

   virtual void redim (int nsf, const char* fieldname);
   void redim (const GridFE& grid, bool elementsRsubdomains,
               const char* fieldname);  // nsd fields
   void redim (int nfields, const GridFE& grid, bool elementsRsubdomains,
               const char* fieldname);

         FieldPiWisConst& operator () (int i);
   const FieldPiWisConst& operator () (int i) const;
   virtual       FieldWithPtValues& component (int i);
   virtual const FieldWithPtValues& component (int i) const;

   virtual Field* getFieldBase (int i = 1) const
   {
     if (sdsfvec(i).ok()) return (Field*) sdsfvec(i).getPtr();
     else                 return NULL;
   }

   virtual void attach (Field& field, int i = 1);
           void attach (FieldPiWisConst& field, int i = 1);
           void attach (FieldsPiWisConst& fields);

           void valueElm (Ptv(NUMT)& vec, int element);
           void valueElm (Ptv(NUMT)& vec, int element) const
           { CAST_CONST_AWAY(FieldsPiWisConst)->valueElm(vec,element); }

   virtual void valuePt  (Ptv(NUMT)& vec, const Ptv(real)& x, real t = DUMMY);
   virtual void valueFEM (Ptv(NUMT)& vec, const FiniteElement& fe,
                          real t = DUMMY);

   void fill (NUMT value);
   void setValueElm (int element, const Ptv(NUMT)& vector);
   void fill (const FieldsFEatItgPt& f);

   virtual int getNoFields () const;
   virtual int getNoValues () const;

   virtual bool ok () const;

   CLASS_INFO

   VIRTUAL_CAST(FieldsPiWisConst)

   // temporary:
   ASSIGNMENT_OPERATOR(FieldsPiWisConst);

   COPY_CONSTRUCTOR(FieldsPiWisConst);

 };



KEYWORDS

piecewise constant vector/tensor field



DESCRIPTION

This  class  offers a vector or tensor field where each component
is a FieldPiWisConst object. The documentation of this  class  is
implicitly  contained  in  class FieldsFE, FieldsWithPtValues and
Fields.



MEMBER FUNCTIONS

valuePt - this function works mainly as the other  valuePt  func­
tions  in  the  Field hierarchy, except that certain problems may
occur if the point is on the boundary between two subdomains. Now
we  force  an  element by element search for the point and return
the value of the field in that element. In case the point  is  on
the  boundary,  the field value corresponding to the element that
first gives a hit is returned. Previously, we tested if the point
was  a  node  and  then always returned DUMMY and gave a warning.
This is not a good solution because  in  higher  order  elements,
internal  nodes  do not represent a problem, and the field may be
multi-valued at general points  in  between  the  nodes  along  a
boundary  between  two  subdomains.  Hence, the only satisfactory
solution is thought to be the one which is implemented now.

The routine now works in conjunction with f.ex.   finite  differ­
ences or nodal point integration in FEM, but the effective bound­
aries of the subdomains (in the numerical  calculations)  are  in
fact  influenced  by the search algorithm in case the point is on
the boundary between two subdomains. This is a topic for  further
research.

fill   (FieldsFEatItgPt&)   -   repeated   calls  to  FieldPiWis­
Const::fill(FieldsFEatItgPt&,int.


SEE ALSO

class FieldPiWisConst, class FieldFE


DEVELOPED BY

SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway


AUTHOR

Hans Petter Langtangen, SINTEF/UiO