Classes | |
class | ArnoldFalkWintherWeakSymSigma |
class | ArnoldFalkWintherWeakSymU |
class | ArnoldFalkWintherWeakSymP |
class | BrezziDouglasMarini |
class | Bubble |
class | CrouzeixRaviart |
class | VectorCrouzeixRaviart |
class | DiscontinuousLagrange |
class | VectorDiscontinuousLagrange |
class | Dof |
class | FE |
class | StandardFE |
class | SymbolMapBuilderVisitor |
class | SymbolCounterVisitor |
class | ExStatsVisitor |
class | ExStats |
class | Hermite |
class | Lagrange |
class | VectorLagrange |
class | TensorLagrange |
class | MixedFE |
class | Nedelec |
class | Nedelec2Hdiv |
class | OrderedPtvSet |
struct | OrderedPtvSet_is_less |
class | OrderedPtvSet_i |
struct | OrderedPtvSet_i_is_less |
class | P0 |
class | VectorP0 |
class | TensorP0 |
class | Polygon |
class | Line |
class | ReferenceLine |
class | Triangle |
class | ReferenceTriangle |
class | Rectangle |
class | ReferenceRectangle |
class | Tetrahedron |
class | ReferenceTetrahedron |
class | Box |
class | ReferenceBox |
class | Simplex |
class | RaviartThomas |
class | Robust |
class | SpaceTimeDomain |
class | SpaceTimeElement |
class | _object |
class | SwigPyIterator |
class | exvector |
class | exmap |
class | ex_int_map |
class | symexpair |
class | symexlist |
class | exlist |
class | exset |
Typedefs | |
typedef std::pair < GiNaC::symbol, GiNaC::ex > | symexpair |
typedef std::list< std::pair < GiNaC::symbol, GiNaC::ex > > | symexlist |
typedef std::list< GiNaC::ex > | exlist |
typedef std::set< GiNaC::ex, GiNaC::ex_is_less > | exset |
typedef std::map< GiNaC::ex, int, GiNaC::ex_is_less > | ex_int_map |
typedef std::pair< unsigned int, unsigned int > | pair_ii |
typedef std::vector< std::pair < unsigned int, unsigned int > > | vector_ii |
Enumerations | |
enum | Repr_format { SUBS_PERFORMED = 1, SUBS_NOT_PERFORMED = 2 } |
Functions | |
GiNaC::ex | div (GiNaC::ex v) |
GiNaC::ex | div (GiNaC::ex v, GiNaC::ex G) |
GiNaC::ex | div (GiNaC::lst &v) |
GiNaC::ex | div (GiNaC::lst &v, GiNaC::ex G) |
GiNaC::ex | div (GiNaC::exvector &v) |
GiNaC::ex | grad (GiNaC::ex f) |
GiNaC::ex | grad (GiNaC::ex f, GiNaC::ex G) |
void | usage (FE &fe) |
void | usage (FE &v_fe, FE &p_fe) |
void | compute_Poisson_element_matrix (FE &fe, Dof &dof, std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > &A) |
void | compute_Stokes_element_matrix (FE &v_fe, FE &p_fe, Dof &dof, std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > &A) |
void | compute_mixed_Poisson_element_matrix (FE &v_fe, FE &p_fe, Dof &dof, std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > &A) |
GiNaC::lst | cross (GiNaC::lst &v1, GiNaC::lst &v2) |
GiNaC::ex | inner (GiNaC::ex a, GiNaC::ex b, bool transposed) |
GiNaC::ex | inner (GiNaC::lst v1, GiNaC::lst v2) |
GiNaC::ex | inner (GiNaC::exvector &v1, GiNaC::exvector &v2) |
GiNaC::lst | matvec (GiNaC::matrix &M, GiNaC::lst &x) |
GiNaC::ex | matvec (GiNaC::ex A, GiNaC::ex x) |
GiNaC::lst | ex2equations (GiNaC::ex rel) |
GiNaC::lst | collapse (GiNaC::lst l) |
GiNaC::matrix | equations2matrix (const GiNaC::ex &eqns, const GiNaC::ex &symbols) |
void | matrix_from_equations (const GiNaC::ex &eqns, const GiNaC::ex &symbols, GiNaC::matrix &A, GiNaC::matrix &b) |
GiNaC::ex | lst_to_matrix2 (const GiNaC::lst &l) |
GiNaC::lst | matrix_to_lst2 (const GiNaC::ex &m) |
GiNaC::lst | lst_equals (GiNaC::ex a, GiNaC::ex b) |
int | find (GiNaC::ex e, GiNaC::lst list) |
void | visitor_subst_pow (GiNaC::ex e, GiNaC::exmap &map, ex_int_map &intmap, string a) |
void | check_visitor (GiNaC::ex e, GiNaC::lst &exlist) |
GiNaC::ex | homogenous_pol (unsigned int order, unsigned int nsd, const string a) |
GiNaC::lst | homogenous_polv (unsigned int no_fields, unsigned int order, unsigned int nsd, const string a) |
GiNaC::ex | pol (unsigned int order, unsigned int nsd, const string a) |
GiNaC::lst | polv (unsigned int no_fields, unsigned int order, unsigned int nsd, const string a) |
GiNaC::ex | polb (unsigned int order, unsigned int nsd, const string a) |
GiNaC::lst | coeffs (GiNaC::lst pols) |
GiNaC::lst | coeffs (GiNaC::ex pol) |
GiNaC::exvector | coeff (GiNaC::ex pol) |
GiNaC::exmap | pol2basisandcoeff (GiNaC::ex e, GiNaC::ex s) |
GiNaC::exmap | pol2basisandcoeff (GiNaC::ex e) |
GiNaC::ex | legendre1D (const GiNaC::symbol x, unsigned int n) |
GiNaC::ex | legendre (unsigned int order, unsigned int nsd, const string s) |
GiNaC::lst | legendrev (unsigned int no_fields, unsigned int order, unsigned int nsd, const string a) |
bool | compare (const ex &e, const string &s) |
void | EQUAL_OR_DIE (const ex &e, const string &s) |
exhashmap< int > | count_symbols (const ex &e) |
ex | extract_symbols (const ex &e) |
void | collect_symbols (const GiNaC::ex &e, exset &v) |
GiNaC::exvector | collect_symbols (const GiNaC::ex &e) |
bool | compare_archives (const string &first, const string &second, std::ostream &os) |
ExStats | count_ops (const ex &e) |
ex | replace_powers (const ex &ein, const list< symbol > &symbols, list< symexpair > &sel, const string &tmpsymbolprefix) |
bool | compare (const GiNaC::ex &e, const std::string &s) |
void | EQUAL_OR_DIE (const GiNaC::ex &e, const std::string &s) |
bool | compare_archives (const std::string &first, const std::string &second, std::ostream &os=std::cout) |
void | visitor_subst_pow (GiNaC::ex e, GiNaC::exmap &map, ex_int_map &intmap, std::string a) |
GiNaC::ex | pol (unsigned int order, unsigned int nsd, const std::string a) |
GiNaC::lst | polv (unsigned int no_fields, unsigned int order, unsigned int nsd, const std::string a) |
GiNaC::ex | polb (unsigned int order, unsigned int nsd, const std::string a) |
GiNaC::ex | homogenous_pol (unsigned int order, unsigned int nsd, const std::string a) |
GiNaC::lst | homogenous_polv (unsigned int no_fields, unsigned int order, unsigned int nsd, const std::string a) |
GiNaC::ex | legendre (unsigned int order, unsigned int nsd, const std::string a) |
GiNaC::lst | legendrev (unsigned int no_fields, unsigned int order, unsigned int nsd, const std::string a) |
GiNaC::exhashmap< int > | count_symbols (const GiNaC::ex &e) |
GiNaC::ex | extract_symbols (const GiNaC::ex &e) |
ExStats | count_ops (const GiNaC::ex &e) |
GiNaC::ex | replace_powers (const GiNaC::ex &e, const std::list< GiNaC::symbol > &symbols, std::list< symexpair > &sel, const std::string &tmpsymbolprefix="p_") |
GiNaC::ex | lagrange (unsigned int order, Polygon &p, const std::string &a) |
GiNaC::lst | lagrangev (unsigned int no_fields, unsigned int order, Polygon &p, const std::string &a) |
std::ostream & | operator<< (std::ostream &os, const OrderedPtvSet &p) |
std::ostream & | operator<< (std::ostream &os, const OrderedPtvSet_i &p) |
lst | bezier_ordinates (Tetrahedron &tetrahedra, unsigned int d) |
lst | interior_coordinates (Tetrahedron &tetrahedra, unsigned int d) |
lst | bezier_ordinates (Triangle &triangle, unsigned int d) |
lst | interior_coordinates (Triangle &triangle, unsigned int d) |
lst | bezier_ordinates (Line &line, unsigned int d) |
lst | interior_coordinates (Line &line, unsigned int d) |
ex | barycenter_line (ex p0, ex p1) |
ex | barycenter_triangle (ex p0, ex p1, ex p2) |
ex | barycenter_tetrahedron (ex p0, ex p1, ex p2, ex p3) |
ex | barycenter (Simplex &simplex) |
ex | bernstein (unsigned int order, Polygon &p, const string &a) |
lst | bernsteinv (unsigned int no_fields, unsigned int order, Polygon &p, const string &a) |
lst | normal (Tetrahedron &tetrahedron, unsigned int i) |
lst | normal (Triangle &triangle, unsigned int i) |
lst | tangent (Triangle &triangle, unsigned int i) |
GiNaC::ex | barycenter_line (GiNaC::ex p0, GiNaC::ex p1) |
GiNaC::ex | barycenter_triangle (GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2) |
GiNaC::ex | barycenter_tetrahedron (GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2, GiNaC::ex p3) |
GiNaC::ex | bernstein (unsigned int order, Polygon &p, const std::string &a) |
GiNaC::lst | bernsteinv (unsigned int no_fields, unsigned int order, Polygon &p, const std::string &a) |
void | sort_vector (vector< Ptv > &a) |
void | set_tolerance (double tolerance) |
double | mul (const Ptv &a, const Ptv &b) |
double | norm (const Ptv &a) |
void | normalize (Ptv &a) |
void | add (const Ptv &a, const Ptv &b, Ptv &c) |
void | sub (const Ptv &a, const Ptv &b, Ptv &c) |
void | cross (const Ptv &a, const Ptv &b, Ptv &c) |
bool | is_equal (Ptv &a, Ptv &b) |
bool | line_contains (Ptv &e0, Ptv &e1, Ptv &p) |
bool | is_inside_triangle (Ptv &e0, Ptv &e1, Ptv &e2, Ptv &p) |
bool | contains2D (Ptv &e0, Ptv &e1, Ptv &p) |
bool | contains3D (Ptv &e0, Ptv &e1, Ptv &e2, Ptv &p) |
def | swig_import_helper |
def | _swig_setattr_nondynamic |
def | _swig_setattr |
def | _swig_getattr |
def | _swig_repr |
def | setDigits |
def | dirac |
def | int2string |
def | lst2string |
def | compare |
def | EQUAL_OR_DIE |
def | cross |
def | ex2equations |
def | collapse |
def | equations2matrix |
def | matrix_from_equations |
def | lst_to_matrix2 |
def | matrix_to_lst2 |
def | lst_equals |
def | find |
def | check_visitor |
def | visitor_subst_pow |
def | pol |
def | polv |
def | polb |
def | homogenous_pol |
def | homogenous_polv |
def | legendre |
def | legendrev |
def | coeff |
def | count_symbols |
def | extract_symbols |
def | istr |
def | div |
def | grad |
def | compare_archives |
def | inner |
def | matvec |
def | coeffs |
def | pol2basisandcoeff |
def | collect_symbols |
def | count_ops |
def | initSyFi |
def | symbol_exists |
def | get_symbol |
def | get_symbolic_vector |
def | get_symbolic_matrix |
def | replace_powers |
def | isymb |
def | barycenter_line |
def | barycenter_triangle |
def | barycenter_tetrahedron |
def | barycenter |
def | bernstein |
def | bernsteinv |
def | tangent |
def | bezier_ordinates |
def | interior_coordinates |
def | normal |
def | lagrange |
def | lagrangev |
def | compute_Poisson_element_matrix |
def | compute_Stokes_element_matrix |
def | compute_mixed_Poisson_element_matrix |
def | usage |
GiNaC::symbol | x ("(x is not initialized since initSyFi has never been called)") |
GiNaC::symbol | y ("(y is not initialized since initSyFi has never been called)") |
GiNaC::symbol | z ("(z is not initialized since initSyFi has never been called)") |
GiNaC::symbol | t ("(t is not initialized since initSyFi has never been called)") |
GiNaC::symbol | infinity ("(infinity is not initialized since initSyFi has never been called)") |
GiNaC::symbol | DUMMY ("(DUMMY is not initialized since initSyFi has never been called)") |
void | initSyFi (unsigned int nsd_) |
bool | symbol_exists (const string &name) |
const symbol & | get_symbol (const string &name) |
const symbol & | isymb (const string &a, int b) |
const symbol & | isymb (const string &a, int b, int c) |
GiNaC::ex | get_symbolic_vector (int m, const std::string &basename) |
GiNaC::ex | get_symbolic_matrix (int m, int n, const std::string &basename) |
bool | symbol_exists (const std::string &name) |
const GiNaC::symbol & | get_symbol (const std::string &name) |
const GiNaC::symbol & | isymb (const std::string &a, int b) |
const GiNaC::symbol & | isymb (const std::string &a, int b, int c) |
int | dirac (unsigned int i, unsigned int j) |
string | int2string (int i) |
string | istr (const string &a, int b) |
string | istr (const string &a, int b, int c) |
string | lst2string (GiNaC::lst &l) |
string | exvector2string (GiNaC::exvector &v) |
void | print (GiNaC::lst &l) |
void | print (GiNaC::exvector &v) |
void | print (std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > &A) |
void | print (ex_int_map map) |
void | print (GiNaC::exmap map) |
std::string | istr (const std::string &a, int b) |
std::string | istr (const std::string &a, int b, int c) |
Variables | |
tuple | _SyFi = swig_import_helper() |
int | _newclass = 0 |
GINACLIB_MAJOR_VERSION = _SyFi.GINACLIB_MAJOR_VERSION | |
GINACLIB_MINOR_VERSION = _SyFi.GINACLIB_MINOR_VERSION | |
GINACLIB_MICRO_VERSION = _SyFi.GINACLIB_MICRO_VERSION | |
SwigPyIterator_swigregister = _SyFi.SwigPyIterator_swigregister | |
exvector_swigregister = _SyFi.exvector_swigregister | |
exmap_swigregister = _SyFi.exmap_swigregister | |
ex_int_map_swigregister = _SyFi.ex_int_map_swigregister | |
symexpair_swigregister = _SyFi.symexpair_swigregister | |
symexlist_swigregister = _SyFi.symexlist_swigregister | |
exlist_swigregister = _SyFi.exlist_swigregister | |
exset_swigregister = _SyFi.exset_swigregister | |
SYFILIB_MAJOR_VERSION = _SyFi.SYFILIB_MAJOR_VERSION | |
SYFILIB_MINOR_VERSION = _SyFi.SYFILIB_MINOR_VERSION | |
SYFILIB_MICRO_VERSION = _SyFi.SYFILIB_MICRO_VERSION | |
ExStats_swigregister = _SyFi.ExStats_swigregister | |
cvar = _SyFi.cvar | |
version_major = cvar.version_major | |
version_minor = cvar.version_minor | |
version_micro = cvar.version_micro | |
Polygon_swigregister = _SyFi.Polygon_swigregister | |
Line_swigregister = _SyFi.Line_swigregister | |
ReferenceLine_swigregister = _SyFi.ReferenceLine_swigregister | |
Triangle_swigregister = _SyFi.Triangle_swigregister | |
ReferenceTriangle_swigregister = _SyFi.ReferenceTriangle_swigregister | |
Rectangle_swigregister = _SyFi.Rectangle_swigregister | |
ReferenceRectangle_swigregister = _SyFi.ReferenceRectangle_swigregister | |
Tetrahedron_swigregister = _SyFi.Tetrahedron_swigregister | |
ReferenceTetrahedron_swigregister = _SyFi.ReferenceTetrahedron_swigregister | |
Box_swigregister = _SyFi.Box_swigregister | |
ReferenceBox_swigregister = _SyFi.ReferenceBox_swigregister | |
Simplex_swigregister = _SyFi.Simplex_swigregister | |
FE_swigregister = _SyFi.FE_swigregister | |
StandardFE_swigregister = _SyFi.StandardFE_swigregister | |
Lagrange_swigregister = _SyFi.Lagrange_swigregister | |
VectorLagrange_swigregister = _SyFi.VectorLagrange_swigregister | |
TensorLagrange_swigregister = _SyFi.TensorLagrange_swigregister | |
Dof_swigregister = _SyFi.Dof_swigregister | |
CrouzeixRaviart_swigregister = _SyFi.CrouzeixRaviart_swigregister | |
VectorCrouzeixRaviart_swigregister = _SyFi.VectorCrouzeixRaviart_swigregister | |
P0_swigregister = _SyFi.P0_swigregister | |
VectorP0_swigregister = _SyFi.VectorP0_swigregister | |
TensorP0_swigregister = _SyFi.TensorP0_swigregister | |
RaviartThomas_swigregister = _SyFi.RaviartThomas_swigregister | |
DiscontinuousLagrange_swigregister = _SyFi.DiscontinuousLagrange_swigregister | |
VectorDiscontinuousLagrange_swigregister = _SyFi.VectorDiscontinuousLagrange_swigregister | |
Hermite_swigregister = _SyFi.Hermite_swigregister | |
Nedelec_swigregister = _SyFi.Nedelec_swigregister | |
Nedelec2Hdiv_swigregister = _SyFi.Nedelec2Hdiv_swigregister | |
Bubble_swigregister = _SyFi.Bubble_swigregister | |
ArnoldFalkWintherWeakSymSigma_swigregister = _SyFi.ArnoldFalkWintherWeakSymSigma_swigregister | |
ArnoldFalkWintherWeakSymU_swigregister = _SyFi.ArnoldFalkWintherWeakSymU_swigregister | |
ArnoldFalkWintherWeakSymP_swigregister = _SyFi.ArnoldFalkWintherWeakSymP_swigregister | |
Robust_swigregister = _SyFi.Robust_swigregister | |
MixedFE_swigregister = _SyFi.MixedFE_swigregister | |
SpaceTimeDomain_swigregister = _SyFi.SpaceTimeDomain_swigregister | |
SpaceTimeElement_swigregister = _SyFi.SpaceTimeElement_swigregister | |
unsigned int | nsd = 2 |
GiNaC::lst | p |
map< string, symbol > | symbol_collection |
GiNaC::symbol | x |
GiNaC::symbol | y |
GiNaC::symbol | z |
GiNaC::symbol | t |
GiNaC::symbol | infinity |
GiNaC::symbol | DUMMY |
typedef std::map<GiNaC::ex, int, GiNaC::ex_is_less> SyFi::ex_int_map |
Definition at line 26 of file containers.h.
typedef std::list<GiNaC::ex> SyFi::exlist |
Definition at line 23 of file containers.h.
typedef std::set<GiNaC::ex, GiNaC::ex_is_less> SyFi::exset |
Definition at line 24 of file containers.h.
typedef std::pair<unsigned int, unsigned int> SyFi::pair_ii |
typedef std::list< std::pair<GiNaC::symbol, GiNaC::ex> > SyFi::symexlist |
Definition at line 20 of file containers.h.
typedef std::pair<GiNaC::symbol, GiNaC::ex> SyFi::symexpair |
Definition at line 19 of file containers.h.
typedef std::vector< std::pair<unsigned int, unsigned int> > SyFi::vector_ii |
enum SyFi::Repr_format |
Definition at line 13 of file Polygon.h.
00014 { 00015 SUBS_PERFORMED = 1, 00016 SUBS_NOT_PERFORMED = 2 00017 };
def SyFi::_swig_getattr | ( | self, | ||
class_type, | ||||
name | ||||
) | [private] |
Definition at line 50 of file SyFi.py.
00050 : 00051 if (name == "thisown"): return self.this.own() 00052 method = class_type.__swig_getmethods__.get(name,None) 00053 if method: return method(self) 00054 raise AttributeError(name) 00055 def _swig_repr(self):
def SyFi::_swig_repr | ( | self | ) | [private] |
Definition at line 56 of file SyFi.py.
00056 : 00057 try: strthis = "proxy of " + self.this.__repr__() 00058 except: strthis = "" 00059 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) 00060 00061 try: 00062 _object = object 00063 _newclass = 1 except AttributeError:
def SyFi::_swig_setattr | ( | self, | ||
class_type, | ||||
name, | ||||
value | ||||
) | [private] |
Definition at line 47 of file SyFi.py.
00047 : 00048 return _swig_setattr_nondynamic(self,class_type,name,value,0) 00049 def _swig_getattr(self,class_type,name):
def SyFi::_swig_setattr_nondynamic | ( | self, | ||
class_type, | ||||
name, | ||||
value, | ||||
static = 1 | ||||
) | [private] |
Definition at line 34 of file SyFi.py.
00034 : 00035 if (name == "thisown"): return self.this.own(value) 00036 if (name == "this"): 00037 if type(value).__name__ == 'SwigPyObject': 00038 self.__dict__[name] = value 00039 return 00040 method = class_type.__swig_setmethods__.get(name,None) 00041 if method: return method(self,value) 00042 if (not static) or hasattr(self,name): 00043 self.__dict__[name] = value 00044 else: 00045 raise AttributeError("You cannot add attributes to %s" % self) 00046 def _swig_setattr(self,class_type,name,value):
Definition at line 62 of file Ptv_tools.cpp.
References Ptv::redim(), and Ptv::size().
Referenced by ex2type().
00063 { 00064 if ( a.size() != b.size() ) 00065 { 00066 throw(std::logic_error("Exception from add(const Ptv&, const Ptv&, Ptv&): The dimentions of a and b must be the same.")); 00067 } 00068 00069 c.redim(a.size()); 00070 for (unsigned int i=0; i< c.size(); i++) 00071 { 00072 c[i] = a[i] + b[i]; 00073 } 00074 }
def SyFi::barycenter | ( | args | ) |
GiNaC::ex SyFi::barycenter | ( | Simplex & | simplex | ) |
Definition at line 1734 of file Polygon.cpp.
References get_symbolic_vector(), SyFi::Polygon::no_vertices(), and SyFi::Polygon::vertex().
Referenced by _wrap_barycenter(), and main().
01735 { 01736 if (nsd != simplex.no_vertices()-1) 01737 { 01738 throw std::runtime_error("Could not compute the barycentric coordinates. Not implemented yet for simplices with no_vertices != nsd +1."); 01739 } 01740 01741 // put symbols in lst 01742 ex b = get_symbolic_vector(simplex.no_vertices(), "b"); 01743 lst symbols; 01744 for (unsigned int i=0; i<b.nops(); i++) 01745 { 01746 symbols.append(b.op(i)); 01747 } 01748 01749 // put equations in lst 01750 lst eqs; 01751 for (unsigned int i=0; i<nsd; i++) 01752 { 01753 ex sum = 0; 01754 for (unsigned int k=0; k< simplex.no_vertices(); k++) 01755 { 01756 sum += b.op(k)*simplex.vertex(k).op(i); 01757 } 01758 ex eqi = p[i] == sum; 01759 eqs.append(eqi); 01760 } 01761 01762 // last eq, sum = 1 01763 ex sum = 0; 01764 for (unsigned int i=0; i<symbols.nops(); i++) 01765 { 01766 sum += symbols.op(i); 01767 } 01768 ex last_eq = 1 == sum; 01769 eqs.append(last_eq); 01770 01771 // solve equations 01772 ex sol = lsolve(eqs, symbols); 01773 return sol; 01774 }
def SyFi::barycenter_line | ( | args | ) |
barycenter_line(GiNaC::ex p0, GiNaC::ex p1) -> GiNaC::ex
Definition at line 1959 of file SyFi.py.
01959 : 01960 """barycenter_line(GiNaC::ex p0, GiNaC::ex p1) -> GiNaC::ex""" 01961 return _SyFi.barycenter_line(*args) 01962 def barycenter_triangle(*args):
GiNaC::ex SyFi::barycenter_line | ( | GiNaC::ex | p0, | |
GiNaC::ex | p1 | |||
) |
ex SyFi::barycenter_line | ( | ex | p0, | |
ex | p1 | |||
) |
Definition at line 1589 of file Polygon.cpp.
References x.
Referenced by _wrap_barycenter_line(), and bernstein().
01590 { 01591 ex sol; 01592 01593 // 1D 01594 if (!GiNaC::is_a<lst>(p0)) 01595 { 01596 GiNaC::symbol b0("b0"), b1("b1"); 01597 ex eq1 = x == b0*p0 + b1*p1; 01598 ex eq2 = 1 == b0 + b1; 01599 sol = lsolve(lst(eq1, eq2), lst(b0, b1)); 01600 } 01601 else if (p0.nops() == 1 && p1.nops() == 1) 01602 { 01603 GiNaC::symbol b0("b0"), b1("b1"); 01604 ex eq1 = x == b0*p0.op(0) + b1*p1.op(0); 01605 ex eq2 = 1 == b0 + b1; 01606 sol = lsolve(lst(eq1, eq2), lst(b0, b1)); 01607 if ( sol == 0 ) 01608 { 01609 ex eq1 = y == b0*p0.op(1) + b1*p1.op(1); 01610 sol = lsolve(lst(eq1, eq2), lst(b0, b1)); 01611 } 01612 if ( sol == 0 ) 01613 { 01614 ex eq1 = z == b0*p0.op(2) + b1*p1.op(2); 01615 sol = lsolve(lst(eq1, eq2), lst(b0, b1)); 01616 } 01617 } 01618 //2D 01619 else if ( p0.nops() == 2 && p1.nops() == 2 ) 01620 { 01621 GiNaC::symbol b0("b0"), b1("b1"); 01622 ex eq1 = x == b0*p0.op(0) + b1*p1.op(0); 01623 ex eq3 = 1 == b0 + b1; 01624 sol = lsolve(lst(eq1, eq3), lst(b0, b1)); 01625 if (sol.nops() == 0) 01626 { 01627 ex eq2 = y == b0*p0.op(1) + b1*p1.op(1); 01628 sol = lsolve(lst(eq2, eq3), lst(b0, b1)); 01629 } 01630 } 01631 //3D 01632 else if ( p0.nops() == 3 && p1.nops() == 3 ) 01633 { 01634 GiNaC::symbol b0("b0"), b1("b1"); 01635 ex eq1 = x == b0*p0.op(0) + b1*p1.op(0); 01636 ex eq4 = 1 == b0 + b1; 01637 sol = lsolve(lst(eq1, eq4), lst(b0, b1)); 01638 if (sol.nops() == 0) 01639 { 01640 ex eq2 = y == b0*p0.op(1) + b1*p1.op(1); 01641 sol = lsolve(lst(eq2, eq4), lst(b0, b1)); 01642 } 01643 if (sol.nops() == 0) 01644 { 01645 ex eq3 = z == b0*p0.op(2) + b1*p1.op(2); 01646 sol = lsolve(lst(eq3, eq4), lst(b0, b1)); 01647 } 01648 } 01649 else 01650 { 01651 throw std::runtime_error("Could not compute the barycentric coordinates. Check the coordinates."); 01652 } 01653 01654 return sol; 01655 }
def SyFi::barycenter_tetrahedron | ( | args | ) |
barycenter_tetrahedron(GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2, GiNaC::ex p3) -> GiNaC::ex
Definition at line 1967 of file SyFi.py.
01967 : 01968 """barycenter_tetrahedron(GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2, GiNaC::ex p3) -> GiNaC::ex""" 01969 return _SyFi.barycenter_tetrahedron(*args) 01970 def barycenter(*args):
GiNaC::ex SyFi::barycenter_tetrahedron | ( | GiNaC::ex | p0, | |
GiNaC::ex | p1, | |||
GiNaC::ex | p2, | |||
GiNaC::ex | p3 | |||
) |
ex SyFi::barycenter_tetrahedron | ( | ex | p0, | |
ex | p1, | |||
ex | p2, | |||
ex | p3 | |||
) |
Definition at line 1718 of file Polygon.cpp.
References x.
Referenced by _wrap_barycenter_tetrahedron(), barycenter_triangle(), bernstein(), and SyFi::Bubble::compute_basis_functions().
01719 { 01720 GiNaC::symbol b0("b0"), b1("b1"), b2("b2"), b3("b3"); 01721 01722 // 3D 01723 ex eq1 = x == b0*p0.op(0) + b1*p1.op(0) + b2*p2.op(0) + b3*p3.op(0); 01724 ex eq2 = y == b0*p0.op(1) + b1*p1.op(1) + b2*p2.op(1) + b3*p3.op(1); 01725 ex eq3 = z == b0*p0.op(2) + b1*p1.op(2) + b2*p2.op(2) + b3*p3.op(2); 01726 ex eq4 = 1 == b0 + b1 + b2 +b3; 01727 01728 ex sol = lsolve(lst(eq1, eq2, eq3, eq4), lst(b0, b1, b2, b3)); 01729 01730 return sol; 01731 01732 }
def SyFi::barycenter_triangle | ( | args | ) |
barycenter_triangle(GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2) -> GiNaC::ex
Definition at line 1963 of file SyFi.py.
01963 : 01964 """barycenter_triangle(GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2) -> GiNaC::ex""" 01965 return _SyFi.barycenter_triangle(*args) 01966 def barycenter_tetrahedron(*args):
GiNaC::ex SyFi::barycenter_triangle | ( | GiNaC::ex | p0, | |
GiNaC::ex | p1, | |||
GiNaC::ex | p2 | |||
) |
ex SyFi::barycenter_triangle | ( | ex | p0, | |
ex | p1, | |||
ex | p2 | |||
) |
Definition at line 1657 of file Polygon.cpp.
References barycenter_tetrahedron(), cross(), test::n, and x.
Referenced by _wrap_barycenter_triangle(), bernstein(), and SyFi::Bubble::compute_basis_functions().
01658 { 01659 ex sol; 01660 01661 // 2D 01662 if ( p0.nops() == 2 && p1.nops() == 2 && p2.nops() == 2) 01663 { 01664 GiNaC::symbol b0("b0"), b1("b1"), b2("b2"); 01665 ex eq1 = x == b0*p0.op(0) + b1*p1.op(0) + b2*p2.op(0); 01666 ex eq2 = y == b0*p0.op(1) + b1*p1.op(1) + b2*p2.op(1); 01667 ex eq3 = 1 == b0 + b1 + b2; 01668 01669 sol = lsolve(lst(eq1, eq2, eq3), lst(b0, b1, b2)); 01670 } 01671 // 3D 01672 else if ( p0.nops() == 3 && p1.nops() == 3 && p2.nops() == 3) 01673 { 01674 lst n1(p1.op(0) - p0.op(0), p1.op(1) - p0.op(1), p1.op(2) - p0.op(2)); 01675 lst n2 = lst(p2.op(0) - p0.op(0), p2.op(1) - p0.op(1), p2.op(2) - p0.op(2)); 01676 lst n = cross(n1,n2); 01677 01678 lst midpoint = lst((p0.op(0) + p1.op(0) + p2.op(0))/3, 01679 (p0.op(1) + p1.op(1) + p2.op(1))/3, 01680 (p0.op(2) + p1.op(2) + p2.op(2))/3); 01681 01682 ex p3 = lst(midpoint.op(0) + n.op(0), 01683 midpoint.op(1) + n.op(1), 01684 midpoint.op(2) + n.op(2)); 01685 01686 ex s = barycenter_tetrahedron(p0, p1, p2, p3); 01687 lst solution; 01688 for (unsigned int i=0; i<s.nops(); i++) 01689 { 01690 ex d = s.op(i).subs(x == p3.op(0)).subs(y == p3.op(1)).subs(z == p3.op(2)); 01691 d = d.rhs(); 01692 if ( GiNaC::is_a<GiNaC::numeric>(d)) 01693 { 01694 // FIXME: bad test, should use the toleranse variable set by CLN or something 01695 if ( GiNaC::abs(GiNaC::ex_to<GiNaC::numeric>(d)) < 10e-8) 01696 { 01697 solution.append(s.op(i)); 01698 } 01699 } 01700 else 01701 { 01702 if ( d.is_zero() ) 01703 { 01704 solution.append(s.op(i)); 01705 } 01706 } 01707 } 01708 sol = solution; 01709 } 01710 else 01711 { 01712 throw std::runtime_error("Could not compute the barycentric coordinates. Check the coordinates."); 01713 } 01714 01715 return sol; 01716 }
def SyFi::bernstein | ( | args | ) |
bernstein(unsigned int order, Polygon p, string a) -> GiNaC::ex
Definition at line 1975 of file SyFi.py.
01975 : 01976 """bernstein(unsigned int order, Polygon p, string a) -> GiNaC::ex""" 01977 return _SyFi.bernstein(*args) 01978 def bernsteinv(*args):
GiNaC::ex SyFi::bernstein | ( | unsigned int | order, | |
Polygon & | p, | |||
const std::string & | a | |||
) |
ex SyFi::bernstein | ( | unsigned int | order, | |
Polygon & | p, | |||
const string & | a | |||
) |
Definition at line 1776 of file Polygon.cpp.
References barycenter_line(), barycenter_tetrahedron(), barycenter_triangle(), get_symbolic_matrix(), matrix_to_lst2(), SyFi::Polygon::str(), and SyFi::Polygon::vertex().
Referenced by _wrap_bernstein(), bernsteinv(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::Lagrange::compute_basis_functions(), SyFi::CrouzeixRaviart::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), and main().
01777 { 01778 01779 if ( order < 0 ) 01780 { 01781 throw(std::logic_error("Can not create polynomials of order less than 0!")); 01782 } 01783 01784 ex ret; // ex to return 01785 int dof; // degrees of freedom 01786 ex A; // ex holding the coefficients a_0 .. a_dof 01787 lst basis; 01788 01789 if ( p.str().find("Line") != string::npos ) 01790 { 01791 ex bary = barycenter_line(p.vertex(0), p.vertex(1)); 01792 ex b0= bary.op(0).rhs(); 01793 ex b1= bary.op(1).rhs(); 01794 dof = order+1; 01795 A = get_symbolic_matrix(1,dof, a); 01796 int o=0; 01797 for (GiNaC::const_iterator i = A.begin(); i != A.end(); ++i) 01798 { 01799 ex scale = GiNaC::binomial(order,o); 01800 ret += (*i)*scale*pow(b0,o)*pow(b1,order-o); 01801 basis.append(scale*pow(b0,o)*pow(b1,order-o)); 01802 o++; 01803 } 01804 } 01805 else if ( p.str().find("Triangle") != string::npos ) 01806 { 01807 01808 dof = (order+1)*(order+2)/2; 01809 A = get_symbolic_matrix(1, dof , a); 01810 01811 ex bary = barycenter_triangle(p.vertex(0), p.vertex(1), p.vertex(2)); 01812 ex b0= bary.op(0).rhs(); 01813 ex b1= bary.op(1).rhs(); 01814 ex b2= bary.op(2).rhs(); 01815 01816 size_t i=0; 01817 for (unsigned int o1 = 0; o1 <= order; o1++) 01818 { 01819 for (unsigned int o2 = 0; o2 <= order; o2++) 01820 { 01821 for (unsigned int o3 = 0; o3 <= order; o3++) 01822 { 01823 if ( o1 + o2 + o3 == order ) 01824 { 01825 ex scale = (GiNaC::factorial(order)/(GiNaC::factorial(o1)*GiNaC::factorial(o2)*GiNaC::factorial(o3))); 01826 ret += A.op(i)*scale*pow(b0,o1)*pow(b1,o2)*pow(b2,o3); 01827 01828 basis.append(scale*pow(b0,o1)*pow(b1,o2)*pow(b2,o3)); 01829 i++; 01830 } 01831 } 01832 } 01833 } 01834 } 01835 01836 else if ( p.str().find("Tetrahedron") != string::npos ) 01837 { 01838 01839 dof = 0; 01840 for (unsigned int j=0; j<= order; j++) 01841 { 01842 dof += (j+1)*(j+2)/2; 01843 } 01844 A = get_symbolic_matrix(1, dof , a); 01845 01846 ex bary = barycenter_tetrahedron(p.vertex(0), p.vertex(1), p.vertex(2), p.vertex(3)); 01847 ex b0= bary.op(0).rhs(); 01848 ex b1= bary.op(1).rhs(); 01849 ex b2= bary.op(2).rhs(); 01850 ex b3= bary.op(3).rhs(); 01851 01852 size_t i=0; 01853 for (unsigned int o1 = 0; o1 <= order; o1++) 01854 { 01855 for (unsigned int o2 = 0; o2 <= order; o2++) 01856 { 01857 for (unsigned int o3 = 0; o3 <= order; o3++) 01858 { 01859 for (unsigned int o4 = 0; o4 <= order; o4++) 01860 { 01861 if ( o1 + o2 + o3 + o4 == order ) 01862 { 01863 ex scale = (GiNaC::factorial(order)/(GiNaC::factorial(o1)*GiNaC::factorial(o2)*GiNaC::factorial(o3)*GiNaC::factorial(o4))); 01864 ret += A.op(i)*scale*pow(b0,o1)*pow(b1,o2)*pow(b2,o3)*pow(b3,o4); 01865 basis.append(scale*pow(b0,o1)*pow(b1,o2)*pow(b2,o3)*pow(b3,o4)); 01866 i++; 01867 } 01868 } 01869 } 01870 } 01871 } 01872 } 01873 01874 else if (p.str() == "Simplex" || p.str() == "ReferenceSimplex") 01875 { 01876 01877 throw std::runtime_error("Not implemented yet."); 01878 // ex bary = barycenter(p); 01879 } 01880 return lst(ret,matrix_to_lst2(A),basis); 01881 }
def SyFi::bernsteinv | ( | args | ) |
bernsteinv(unsigned int no_fields, unsigned int order, Polygon p, string a) -> GiNaC::lst
Definition at line 1979 of file SyFi.py.
01979 : 01980 """ 01981 bernsteinv(unsigned int no_fields, unsigned int order, Polygon p, 01982 string a) -> GiNaC::lst 01983 """ 01984 return _SyFi.bernsteinv(*args) 01985 def tangent(*args):
GiNaC::lst SyFi::bernsteinv | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
Polygon & | p, | |||
const std::string & | a | |||
) |
lst SyFi::bernsteinv | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
Polygon & | p, | |||
const string & | a | |||
) |
Definition at line 1883 of file Polygon.cpp.
References bernstein(), pol(), and SyFi::Polygon::str().
Referenced by _wrap_bernsteinv(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), and SyFi::Robust::compute_basis_functions_old().
01884 { 01885 01886 if ( order < 0 ) 01887 { 01888 throw(std::logic_error("Can not create polynomials of order less than 0!")); 01889 } 01890 01891 lst ret1; // contains the polynom 01892 lst ret2; // contains the coefficients 01893 lst ret3; // constains the basis functions 01894 lst basis_tmp; 01895 for (unsigned int i=0; i< no_fields; i++) 01896 { 01897 lst basis; 01898 std::ostringstream s; 01899 s <<a<<""<<i<<"_"; 01900 ex pol = bernstein(order, p, s.str()); 01901 ret1.append(pol.op(0)); 01902 ret2.append(pol.op(1)); 01903 basis_tmp = ex_to<lst>(pol.op(2)); 01904 for (lst::const_iterator basis_iterator = basis_tmp.begin(); 01905 basis_iterator != basis_tmp.end(); ++basis_iterator) 01906 { 01907 lst tmp_lst; 01908 for (unsigned int d=1; d<=no_fields; d++) tmp_lst.append(0); 01909 tmp_lst.let_op(i) = (*basis_iterator); 01910 ret3.append(tmp_lst); 01911 } 01912 } 01913 return lst(ret1,ret2,ret3); 01914 01915 }
def SyFi::bezier_ordinates | ( | args | ) |
bezier_ordinates(Line line, unsigned int d) -> GiNaC::lst bezier_ordinates(Triangle triangle, unsigned int d) -> GiNaC::lst bezier_ordinates(Tetrahedron tetrahedra, unsigned int d) -> GiNaC::lst
Definition at line 2030 of file SyFi.py.
02030 : 02031 """ 02032 bezier_ordinates(Line line, unsigned int d) -> GiNaC::lst 02033 bezier_ordinates(Triangle triangle, unsigned int d) -> GiNaC::lst 02034 bezier_ordinates(Tetrahedron tetrahedra, unsigned int d) -> GiNaC::lst 02035 """ 02036 return _SyFi.bezier_ordinates(*args) 02037 def interior_coordinates(*args):
GiNaC::lst SyFi::bezier_ordinates | ( | Line & | line, | |
unsigned int | d | |||
) |
Definition at line 1517 of file Polygon.cpp.
References lst_to_matrix2(), matrix_to_lst2(), and SyFi::Polygon::vertex().
01518 { 01519 01520 lst ret; 01521 ex V1 = line.vertex(0); 01522 ex V2 = line.vertex(1); 01523 01524 if (!GiNaC::is_a<lst>(V1)) 01525 { 01526 int k; 01527 for (unsigned int i=0; i <= d; i++) 01528 { 01529 k = d - i; 01530 ex sum = (k*V1 + i*V2)/d; 01531 ret.append(sum); 01532 } 01533 } 01534 else 01535 { 01536 01537 //FIXME: ugly conversion to matrix 01538 01539 lst V1l = ex_to<lst>(V1); 01540 lst V2l = ex_to<lst>(V2); 01541 01542 ex V1m = lst_to_matrix2(V1l); 01543 ex V2m = lst_to_matrix2(V2l); 01544 01545 int k; 01546 for (unsigned int i=0; i <= d; i++) 01547 { 01548 k = d - i; 01549 ex sum = (k*V1m + i*V2m)/d; 01550 ret.append(matrix_to_lst2(sum.evalm())); 01551 } 01552 // FIXME how should these be sorted ????? 01553 // ret = ret.sort(); 01554 } 01555 return ret; 01556 }
GiNaC::lst SyFi::bezier_ordinates | ( | Triangle & | triangle, | |
unsigned int | d | |||
) |
Definition at line 1443 of file Polygon.cpp.
References lst_to_matrix2(), matrix_to_lst2(), and SyFi::Polygon::vertex().
01444 { 01445 01446 //FIXME: ugly conversion to matrix 01447 01448 lst ret; 01449 ex V1 = triangle.vertex(0); 01450 ex V2 = triangle.vertex(1); 01451 ex V3 = triangle.vertex(2); 01452 01453 lst V1l = ex_to<lst>(V1); 01454 lst V2l = ex_to<lst>(V2); 01455 lst V3l = ex_to<lst>(V3); 01456 01457 ex V1m = lst_to_matrix2(V1l); 01458 ex V2m = lst_to_matrix2(V2l); 01459 ex V3m = lst_to_matrix2(V3l); 01460 01461 int k; 01462 for (unsigned int i=0; i <= d; i++) 01463 { 01464 for (unsigned int j=0; j <= d; j++) 01465 { 01466 if ( int(d) - int(i) - int(j) >= 0 ) 01467 { 01468 k = d - i - j; 01469 ex sum = (k*V1m + j*V2m + i*V3m)/d; 01470 ret.append(matrix_to_lst2(sum.evalm())); 01471 } 01472 } 01473 } 01474 // FIXME how should these be sorted ????? 01475 // ret = ret.sort(); 01476 return ret; 01477 }
GiNaC::lst SyFi::bezier_ordinates | ( | Tetrahedron & | tetrahedra, | |
unsigned int | d | |||
) |
Definition at line 1358 of file Polygon.cpp.
References SyFi_polygons::spacetimedomain::l, lst_to_matrix2(), matrix_to_lst2(), and SyFi::Polygon::vertex().
Referenced by _wrap_bezier_ordinates__SWIG_0(), _wrap_bezier_ordinates__SWIG_1(), _wrap_bezier_ordinates__SWIG_2(), SyFi::Lagrange::compute_basis_functions(), and main().
01359 { 01360 01361 //FIXME: ugly conversion to matrix 01362 01363 lst ret; 01364 ex V1 = tetrahedra.vertex(0); 01365 ex V2 = tetrahedra.vertex(1); 01366 ex V3 = tetrahedra.vertex(2); 01367 ex V4 = tetrahedra.vertex(3); 01368 01369 lst V1l = ex_to<lst>(V1); 01370 lst V2l = ex_to<lst>(V2); 01371 lst V3l = ex_to<lst>(V3); 01372 lst V4l = ex_to<lst>(V4); 01373 01374 ex V1m = lst_to_matrix2(V1l); 01375 ex V2m = lst_to_matrix2(V2l); 01376 ex V3m = lst_to_matrix2(V3l); 01377 ex V4m = lst_to_matrix2(V4l); 01378 01379 int l; 01380 for (unsigned int i=0; i<= d; i++) 01381 { 01382 for (unsigned int j=0; j<= d; j++) 01383 { 01384 for (unsigned int k=0; k<= d; k++) 01385 { 01386 if ( d - i - j -k >= 0 ) 01387 { 01388 l= d - i - j -k; 01389 ex sum = (l*V1m + k*V2m + j*V3m + i*V4m)/d; 01390 ret.append(matrix_to_lst2(sum.evalm())); 01391 } 01392 } 01393 } 01394 } 01395 // FIXME how should these be sorted ????? 01396 // ret = ret.sort(); 01397 return ret; 01398 }
def SyFi::check_visitor | ( | args | ) |
check_visitor(GiNaC::ex e, GiNaC::lst exlist)
Definition at line 1166 of file SyFi.py.
01166 : 01167 """check_visitor(GiNaC::ex e, GiNaC::lst exlist)""" 01168 return _SyFi.check_visitor(*args) 01169 def visitor_subst_pow(*args):
void SyFi::check_visitor | ( | GiNaC::ex | e, | |
GiNaC::lst & | exlist | |||
) |
Definition at line 447 of file ginac_tools.cpp.
References find().
Referenced by _wrap_check_visitor().
00448 { 00449 if (find(e, exlist) >= 0) return; 00450 00451 // cout <<"ex e "<<e<<endl; 00452 if (GiNaC::is_a<GiNaC::numeric>(e)) 00453 { 00454 } 00455 else if (GiNaC::is_a<GiNaC::add>(e) ) 00456 { 00457 // cout <<"e "<<e <<endl; 00458 // cout <<"e.nops() "<<e.nops() <<endl; 00459 if (e.nops() > 4 && e.nops() < 10 ) exlist.append(e); 00460 for (unsigned int i=0; i< e.nops(); i++) 00461 { 00462 GiNaC::ex e2 = e.op(i); 00463 // cout <<"add e "<<e2<<endl; 00464 // exlist.append(e2); 00465 check_visitor(e2,exlist); 00466 } 00467 } 00468 else if (GiNaC::is_a<GiNaC::mul>(e)) 00469 { 00470 for (unsigned int i=0; i< e.nops(); i++) 00471 { 00472 GiNaC::ex e2 = e.op(i); 00473 // cout <<"mul e "<<e2<<endl; 00474 exlist.append(e2); 00475 check_visitor(e2,exlist); 00476 } 00477 } 00478 else if (GiNaC::is_a<GiNaC::lst>(e)) 00479 { 00480 for (unsigned int i=0; i< e.nops(); i++) 00481 { 00482 GiNaC::ex e2 = e.op(i); 00483 // cout <<"GiNaC::lst e "<<e2<<endl; 00484 // exlist.append(e2); 00485 check_visitor(e2,exlist); 00486 } 00487 } 00488 else if (GiNaC::is_exactly_a<GiNaC::power>(e)) 00489 { 00490 exlist.append(e); 00491 for (unsigned int i=0; i< e.nops(); i++) 00492 { 00493 GiNaC::ex e2 = e.op(i); 00494 // cout <<"power e "<<e2<<endl; 00495 check_visitor(e2,exlist); 00496 } 00497 } 00498 else if (GiNaC::is_a<GiNaC::function>(e)) 00499 { 00500 exlist.append(e); 00501 for (unsigned int i=0; i< e.nops(); i++) 00502 { 00503 GiNaC::ex e2 = e.op(i); 00504 // cout <<"function e "<<e2<<endl; 00505 check_visitor(e2,exlist); 00506 } 00507 } 00508 00509 else 00510 { 00511 // exlist.append(e); 00512 // cout <<"atom e "<<e<<endl; 00513 } 00514 00515 exlist.sort(); 00516 exlist.unique(); 00517 }
def SyFi::coeff | ( | args | ) |
coeff(GiNaC::ex pol) -> GiNaC::exvector
Definition at line 1211 of file SyFi.py.
01211 : 01212 """coeff(GiNaC::ex pol) -> GiNaC::exvector""" 01213 return _SyFi.coeff(*args) 01214 def count_symbols(*args):
GiNaC::exvector SyFi::coeff | ( | GiNaC::ex | pol | ) |
Definition at line 841 of file ginac_tools.cpp.
Referenced by _wrap_coeff(), SyFi::Robust::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), and SyFi::Robust::compute_basis_functions_old().
00842 { 00843 using SyFi::x; 00844 using SyFi::y; 00845 using SyFi::z; 00846 00847 GiNaC::exvector cc; 00848 GiNaC::ex c, b; 00849 for (int i=pol.ldegree(x); i<=pol.degree(x); ++i) 00850 { 00851 for (int j=pol.ldegree(y); j<=pol.degree(y); ++j) 00852 { 00853 for (int k=pol.ldegree(z); k<=pol.degree(z); ++k) 00854 { 00855 c = pol.coeff(x,i).coeff(y, j).coeff(z,k); 00856 if ( c != 0 ) cc.insert(cc.begin(),c); 00857 } 00858 } 00859 } 00860 return cc; 00861 }
def SyFi::coeffs | ( | args | ) |
coeffs(GiNaC::ex pol) -> GiNaC::lst coeffs(GiNaC::lst pols) -> GiNaC::lst
Definition at line 1308 of file SyFi.py.
01308 : 01309 """ 01310 coeffs(GiNaC::ex pol) -> GiNaC::lst 01311 coeffs(GiNaC::lst pols) -> GiNaC::lst 01312 """ 01313 return _SyFi.coeffs(*args) 01314 def pol2basisandcoeff(*args):
GiNaC::lst SyFi::coeffs | ( | GiNaC::ex | pol | ) |
Definition at line 818 of file ginac_tools.cpp.
00819 { 00820 using SyFi::x; 00821 using SyFi::y; 00822 using SyFi::z; 00823 00824 GiNaC::lst cc; 00825 GiNaC::ex c, b; 00826 for (int i=pol.ldegree(x); i<=pol.degree(x); ++i) 00827 { 00828 for (int j=pol.ldegree(y); j<=pol.degree(y); ++j) 00829 { 00830 for (int k=pol.ldegree(z); k<=pol.degree(z); ++k) 00831 { 00832 c = pol.coeff(x,i).coeff(y, j).coeff(z,k); 00833 if ( c != 0 ) cc.append(c); 00834 } 00835 } 00836 } 00837 return cc; 00838 }
GiNaC::lst SyFi::coeffs | ( | GiNaC::lst | pols | ) |
Definition at line 805 of file ginac_tools.cpp.
References collapse().
Referenced by _wrap_coeffs__SWIG_0(), and _wrap_coeffs__SWIG_1().
00806 { 00807 GiNaC::lst cc; 00808 GiNaC::lst tmp; 00809 for (unsigned int i=0; i<= pols.nops()-1; i++) 00810 { 00811 tmp = coeffs(pols.op(i)); 00812 cc = collapse(GiNaC::lst(cc, tmp)); 00813 } 00814 return cc; 00815 }
def SyFi::collapse | ( | args | ) |
collapse(GiNaC::lst l) -> GiNaC::lst
Definition at line 1135 of file SyFi.py.
01135 : 01136 """collapse(GiNaC::lst l) -> GiNaC::lst""" 01137 return _SyFi.collapse(*args) 01138 def equations2matrix(*args):
GiNaC::lst SyFi::collapse | ( | GiNaC::lst | l | ) |
Definition at line 200 of file ginac_tools.cpp.
Referenced by _wrap_collapse(), coeffs(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), and SyFi::Robust::compute_basis_functions_old().
00201 { 00202 GiNaC::lst lc; 00203 GiNaC::lst::const_iterator iter1, iter2; 00204 00205 for (iter1 = l.begin(); iter1 != l.end(); ++iter1) 00206 { 00207 if (GiNaC::is_a<GiNaC::lst>(*iter1)) 00208 { 00209 for (iter2 = GiNaC::ex_to<GiNaC::lst>(*iter1).begin(); iter2 != GiNaC::ex_to<GiNaC::lst>(*iter1).end(); ++iter2) 00210 { 00211 lc.append(*iter2); 00212 } 00213 } 00214 else 00215 { 00216 lc.append(*iter1); 00217 } 00218 } 00219 lc.sort(); 00220 lc.unique(); 00221 return lc; 00222 }
def SyFi::collect_symbols | ( | args | ) |
collect_symbols(GiNaC::ex e, exset v) collect_symbols(GiNaC::ex e) -> GiNaC::exvector
Definition at line 1322 of file SyFi.py.
01322 : 01323 """ 01324 collect_symbols(GiNaC::ex e, exset v) 01325 collect_symbols(GiNaC::ex e) -> GiNaC::exvector 01326 """ 01327 return _SyFi.collect_symbols(*args) 01328 01329 def count_ops(*args):
GiNaC::exvector SyFi::collect_symbols | ( | const GiNaC::ex & | e | ) |
Definition at line 1236 of file ginac_tools.cpp.
References SyFi::exset::begin(), collect_symbols(), SyFi::exset::end(), SyFi::exset::iterator(), run::s, and SyFi::exset::size().
01237 { 01238 exset s; 01239 collect_symbols(e, s); 01240 GiNaC::exvector v(s.size()); 01241 for(exset::iterator i=s.begin(); i!= s.end(); i++) 01242 { 01243 v.push_back(*i); 01244 } 01245 return v; 01246 }
void SyFi::collect_symbols | ( | const GiNaC::ex & | e, | |
exset & | v | |||
) |
Definition at line 1220 of file ginac_tools.cpp.
References SyFi::exset::insert().
Referenced by _wrap_collect_symbols__SWIG_0(), _wrap_collect_symbols__SWIG_1(), and collect_symbols().
01221 { 01222 if (GiNaC::is_a<GiNaC::symbol>(e)) 01223 { 01224 v.insert(e); 01225 } 01226 else 01227 { 01228 for (size_t i=0; i<e.nops(); i++) 01229 { 01230 collect_symbols(e.op(i), v); 01231 } 01232 } 01233 }
def SyFi::compare | ( | args | ) |
compare(GiNaC::ex e, string s) -> bool
Definition at line 1119 of file SyFi.py.
01119 : 01120 """compare(GiNaC::ex e, string s) -> bool""" 01121 return _SyFi.compare(*args) 01122 def EQUAL_OR_DIE(*args):
bool SyFi::compare | ( | const GiNaC::ex & | e, | |
const std::string & | s | |||
) |
bool SyFi::compare | ( | const ex & | e, | |
const string & | s | |||
) |
Definition at line 1073 of file ginac_tools.cpp.
Referenced by _wrap_compare(), EQUAL_OR_DIE(), and SWIG_MangledTypeQueryModule().
def SyFi::compare_archives | ( | args | ) |
compare_archives(string first, string second, std::ostream os = std::cout) -> bool compare_archives(string first, string second) -> bool
Definition at line 1285 of file SyFi.py.
01285 : 01286 """ 01287 compare_archives(string first, string second, std::ostream os = std::cout) -> bool 01288 compare_archives(string first, string second) -> bool 01289 """ 01290 return _SyFi.compare_archives(*args) 01291 def inner(*args):
bool SyFi::compare_archives | ( | const std::string & | first, | |
const std::string & | second, | |||
std::ostream & | os = std::cout | |||
) |
bool SyFi::compare_archives | ( | const string & | first, | |
const string & | second, | |||
std::ostream & | os | |||
) |
Definition at line 1249 of file ginac_tools.cpp.
References extract_symbols(), and test::n.
Referenced by _wrap_compare_archives__SWIG_0(), _wrap_compare_archives__SWIG_1(), check_CrouzeixRaviart(), and main().
01250 { 01251 bool ret = true; 01252 01253 // read both archives 01254 archive a1, a2; 01255 ifstream if1(first.c_str()), if2(second.c_str()); 01256 if1 >> a1; 01257 if2 >> a2; 01258 01259 // compare size 01260 int n = a1.num_expressions(); 01261 int n2 = a2.num_expressions(); 01262 if(n != n2) 01263 { 01264 os << "Archives " << first << " and " << second 01265 << " has a different number of expressions, " << n << " and " << n2 << "." << endl; 01266 os << "Comparing common expressions." << endl; 01267 ret = false; 01268 } 01269 01270 // iterate over all expressions in first archive 01271 ex e1,e2; 01272 for(int i=0; i<n; i++) 01273 { 01274 lst syms; 01275 string exname; 01276 01277 e1 = a1.unarchive_ex(syms, exname, i); 01278 01279 syms = ex_to<lst>(extract_symbols(e1)); 01280 // os << "Comparing " << exname << " with symbols " << syms << endl; 01281 01282 // is this in the second archive? 01283 try 01284 { 01285 e2 = a2.unarchive_ex(syms, exname.c_str()); 01286 01287 // got it, now compare 01288 bool isequal = is_zero(e1-e2); 01289 if(!isequal) 01290 { 01291 if(ret) 01292 { 01293 os << "Archives " << first << " and " << second 01294 << " are not equal, details follow:" << endl; 01295 } 01296 os << "Expression with name " << exname << " is not equal:" << endl; 01297 os << "First: " << endl << e1 << endl; 01298 os << "Second: " << endl << e2 << endl; 01299 ret = false; 01300 } 01301 } 01302 catch(...) 01303 { 01304 os << "Expression " << exname << " is missing from " << second << "." << endl; 01305 ret = false; 01306 } 01307 } 01308 01309 return ret; 01310 }
def SyFi::compute_mixed_Poisson_element_matrix | ( | args | ) |
compute_mixed_Poisson_element_matrix(FE v_fe, FE p_fe, Dof dof, std::map<(std::pair<(unsigned int,unsigned int)>,GiNaC::ex,std::less<(std::pair<(unsigned int,unsigned int)>)>,std::allocator<(std::pair<(q(const).std::pair<(unsigned int,unsigned int)>,GiNaC::ex)>)>)> A)
Definition at line 2636 of file SyFi.py.
02636 : 02637 """compute_mixed_Poisson_element_matrix(FE v_fe, FE p_fe, Dof dof, std::map<(std::pair<(unsigned int,unsigned int)>,GiNaC::ex,std::less<(std::pair<(unsigned int,unsigned int)>)>,std::allocator<(std::pair<(q(const).std::pair<(unsigned int,unsigned int)>,GiNaC::ex)>)>)> A)""" 02638 return _SyFi.compute_mixed_Poisson_element_matrix(*args) class ArnoldFalkWintherWeakSymSigma(StandardFE):
void SyFi::compute_mixed_Poisson_element_matrix | ( | FE & | v_fe, | |
FE & | p_fe, | |||
Dof & | dof, | |||
std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > & | A | |||
) |
Definition at line 136 of file ElementComputations.cpp.
References demos::poisson1::Aij, div(), SyFi::FE::dof(), SyFi::FE::get_polygon(), SyFi::Dof::glob_dof(), inner(), SyFi::Dof::insert_dof(), SyFi::Polygon::integrate(), SyFi::FE::N(), and SyFi::FE::nbf().
Referenced by _wrap_compute_mixed_Poisson_element_matrix(), and main().
00141 { 00142 std::pair<unsigned int,unsigned int> index; 00143 std::pair<unsigned int,unsigned int> index2; 00144 00145 // FIXME: need to check that p_fe 00146 // contains the same domain 00147 Polygon& domain = v_fe.get_polygon(); 00148 00149 // Insert the local degrees of freedom into the global Dof 00150 for (unsigned int i=0; i< v_fe.nbf(); i++) 00151 { 00152 dof.insert_dof(1,i,v_fe.dof(i)); 00153 } 00154 for (unsigned int i=0; i< p_fe.nbf(); i++) 00155 { 00156 dof.insert_dof(1,v_fe.nbf()+i+1,p_fe.dof(i)); 00157 } 00158 00159 // The term (u,v) 00160 for (unsigned int i=0; i< v_fe.nbf(); i++) 00161 { 00162 // fetch the global dof related to i and v 00163 index.first = dof.glob_dof(v_fe.dof(i)); 00164 for (unsigned int j=0; j< v_fe.nbf(); j++) 00165 { 00166 // fetch the global dof related to j and p 00167 index.second = dof.glob_dof(v_fe.dof(j)); 00168 // compute the integrand 00169 GiNaC::ex mass = inner(v_fe.N(i),v_fe.N(j)); 00170 // compute the integral 00171 GiNaC::ex Aij = domain.integrate(mass); 00172 A[index] += Aij; // add to global matrix 00173 } 00174 } 00175 00176 // The term -(div u, q) 00177 for (unsigned int i=0; i< p_fe.nbf(); i++) 00178 { 00179 // fetch the global dof for p_i 00180 index.first = dof.glob_dof(p_fe.dof(i)); 00181 for (unsigned int j=0; j< v_fe.nbf(); j++) 00182 { 00183 // fetch the global dof for v_j 00184 index.second=dof.glob_dof(v_fe.dof(j)); 00185 // compute the integrand 00186 GiNaC::ex divV= -p_fe.N(i)*div(v_fe.N(j)); 00187 // compute the integral 00188 GiNaC::ex Aij = domain.integrate(divV); 00189 A[index] += Aij; // add to global matrix 00190 00191 // Do not need to compute the term (grad(p),v), since the system is 00192 // symmetric we simply set Aji = Aij 00193 index2.first = index.second; 00194 index2.second = index.first; 00195 A[index2] += Aij; 00196 } 00197 } 00198 }
def SyFi::compute_Poisson_element_matrix | ( | args | ) |
compute_Poisson_element_matrix(FE fe, Dof dof, std::map<(std::pair<(unsigned int,unsigned int)>,GiNaC::ex,std::less<(std::pair<(unsigned int,unsigned int)>)>,std::allocator<(std::pair<(q(const).std::pair<(unsigned int,unsigned int)>,GiNaC::ex)>)>)> A)
Definition at line 2628 of file SyFi.py.
02628 : 02629 """compute_Poisson_element_matrix(FE fe, Dof dof, std::map<(std::pair<(unsigned int,unsigned int)>,GiNaC::ex,std::less<(std::pair<(unsigned int,unsigned int)>)>,std::allocator<(std::pair<(q(const).std::pair<(unsigned int,unsigned int)>,GiNaC::ex)>)>)> A)""" 02630 return _SyFi.compute_Poisson_element_matrix(*args) 02631 def compute_Stokes_element_matrix(*args):
void SyFi::compute_Poisson_element_matrix | ( | FE & | fe, | |
Dof & | dof, | |||
std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > & | A | |||
) |
Definition at line 38 of file ElementComputations.cpp.
References demos::poisson1::Aij, SyFi::FE::dof(), SyFi::FE::get_polygon(), SyFi::Dof::glob_dof(), grad(), inner(), SyFi::Dof::insert_dof(), SyFi::Polygon::integrate(), SyFi::FE::N(), and SyFi::FE::nbf().
Referenced by _wrap_compute_Poisson_element_matrix().
00042 { 00043 std::pair<unsigned int,unsigned int> index; 00044 00045 // Insert the local degrees of freedom into the global Dof 00046 for (unsigned int i=0; i< fe.nbf(); i++) 00047 { 00048 dof.insert_dof(1,i,fe.dof(i)); 00049 } 00050 00051 Polygon& domain = fe.get_polygon(); 00052 00053 // The term (grad u, grad v) 00054 for (unsigned int i=0; i< fe.nbf(); i++) 00055 { 00056 // fetch the global dof for Ni 00057 index.first = dof.glob_dof(fe.dof(i)); 00058 for (unsigned int j=0; j< fe.nbf(); j++) 00059 { 00060 // fetch the global dof for Nj 00061 index.second = dof.glob_dof(fe.dof(j)); 00062 // compute the integrand 00063 GiNaC::ex nabla = inner(grad(fe.N(i)), 00064 grad(fe.N(j))); 00065 // compute the integral 00066 GiNaC::ex Aij = domain.integrate(nabla); 00067 A[index] += Aij; // add to global matrix 00068 } 00069 } 00070 }
def SyFi::compute_Stokes_element_matrix | ( | args | ) |
compute_Stokes_element_matrix(FE v_fe, FE p_fe, Dof dof, std::map<(std::pair<(unsigned int,unsigned int)>,GiNaC::ex,std::less<(std::pair<(unsigned int,unsigned int)>)>,std::allocator<(std::pair<(q(const).std::pair<(unsigned int,unsigned int)>,GiNaC::ex)>)>)> A)
Definition at line 2632 of file SyFi.py.
02632 : 02633 """compute_Stokes_element_matrix(FE v_fe, FE p_fe, Dof dof, std::map<(std::pair<(unsigned int,unsigned int)>,GiNaC::ex,std::less<(std::pair<(unsigned int,unsigned int)>)>,std::allocator<(std::pair<(q(const).std::pair<(unsigned int,unsigned int)>,GiNaC::ex)>)>)> A)""" 02634 return _SyFi.compute_Stokes_element_matrix(*args) 02635 def compute_mixed_Poisson_element_matrix(*args):
void SyFi::compute_Stokes_element_matrix | ( | FE & | v_fe, | |
FE & | p_fe, | |||
Dof & | dof, | |||
std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > & | A | |||
) |
Definition at line 72 of file ElementComputations.cpp.
References demos::poisson1::Aij, div(), SyFi::FE::dof(), SyFi::FE::get_polygon(), SyFi::Dof::glob_dof(), grad(), inner(), SyFi::Dof::insert_dof(), SyFi::Polygon::integrate(), SyFi::FE::N(), and SyFi::FE::nbf().
Referenced by _wrap_compute_Stokes_element_matrix(), and main().
00077 { 00078 std::pair<unsigned int,unsigned int> index; 00079 std::pair<unsigned int,unsigned int> index2; 00080 00081 // FIXME: need to check that p_fe 00082 // contains the same domain 00083 Polygon& domain = v_fe.get_polygon(); 00084 00085 // Insert the local degrees of freedom into the global Dof 00086 for (unsigned int i=0; i< v_fe.nbf(); i++) 00087 { 00088 dof.insert_dof(1,i,v_fe.dof(i)); 00089 } 00090 for (unsigned int i=0; i< p_fe.nbf(); i++) 00091 { 00092 dof.insert_dof(1,v_fe.nbf()+i,p_fe.dof(i)); 00093 } 00094 00095 // The term (grad u, grad v) 00096 for (unsigned int i=0; i< v_fe.nbf(); i++) 00097 { 00098 // fetch the global dof for v_i 00099 index.first = dof.glob_dof(v_fe.dof(i)); 00100 for (unsigned int j=0; j< v_fe.nbf(); j++) 00101 { 00102 // fetch the global dof for v_j 00103 index.second = dof.glob_dof(v_fe.dof(j)); 00104 GiNaC::ex nabla = inner(grad(v_fe.N(i)), 00105 grad(v_fe.N(j)));// compute the integrand 00106 // compute the integral 00107 GiNaC::ex Aij = domain.integrate(nabla); 00108 A[index] += Aij; // add to global matrix 00109 } 00110 } 00111 00112 // The term -(div u, q) 00113 for (unsigned int i=0; i< p_fe.nbf(); i++) 00114 { 00115 // fetch the global dof for p_i 00116 index.first = dof.glob_dof(p_fe.dof(i)); 00117 for (unsigned int j=0; j< v_fe.nbf(); j++) 00118 { 00119 // fetch the global dof for v_j 00120 index.second=dof.glob_dof(v_fe.dof(j)); 00121 // compute the integrand 00122 GiNaC::ex divV= -p_fe.N(i)*div(v_fe.N(j)); 00123 // compute the integral 00124 GiNaC::ex Aij = domain.integrate(divV); 00125 A[index] += Aij; // add to global matrix 00126 00127 // Do not need to compute the term (grad(p),v), since the system is 00128 // symmetric. We simply set Aji = Aij 00129 index2.first = index.second; 00130 index2.second = index.first; 00131 A[index2] += Aij; 00132 } 00133 } 00134 }
Definition at line 187 of file Ptv_tools.cpp.
References line_contains(), and Ptv::size().
00188 { 00189 00190 if ( e0.size() != e1.size() || e0.size() != p.size() ) 00191 { 00192 throw(std::logic_error("Exception from contains2D(Ptv&, Ptv&, Ptv&): The dimentions of a and b must be the same.")); 00193 } 00194 00195 bool b = line_contains(e0, e1, p); 00196 00197 return b; 00198 }
Definition at line 200 of file Ptv_tools.cpp.
References is_equal(), is_inside_triangle(), and line_contains().
00201 { 00202 00203 // check if p is either e0, e1, or e2 00204 if ( is_equal(e0, p) ) return true; 00205 else if ( is_equal(e1, p) ) return true; 00206 else if ( is_equal(e2, p) ) return true; 00207 00208 // check if p is on the lines connecting e0, e1, and e2 00209 if ( line_contains(e0, e1, p) ) return true; 00210 else if ( line_contains(e1, e2, p) ) return true; 00211 else if ( line_contains(e2, e1, p) ) return true; 00212 00213 // check if p is inside the triangle with verticies e0, e1, and e2 00214 if ( is_inside_triangle(e0, e1, e2, p) ) return true; 00215 00216 return false; 00217 00218 }
def SyFi::count_ops | ( | args | ) |
ExStats SyFi::count_ops | ( | const GiNaC::ex & | e | ) |
ExStats SyFi::count_ops | ( | const ex & | e | ) |
Definition at line 1364 of file ginac_tools.cpp.
References SyFi::ExStatsVisitor::es.
Referenced by _wrap_count_ops(), main(), and print().
01365 { 01366 //cout << "count_ops " << e << endl; 01367 //cout << "is an add: " << GiNaC::is<GiNaC::add>(e) << endl; 01368 //cout << "is a mul: " << GiNaC::is<GiNaC::mul>(e) << endl; 01369 ExStatsVisitor v; 01370 e.traverse(v); 01371 return v.es; 01372 }
def SyFi::count_symbols | ( | args | ) |
count_symbols(GiNaC::ex e) -> GiNaC::exhashmap<(int)>
Definition at line 1215 of file SyFi.py.
01215 : 01216 """count_symbols(GiNaC::ex e) -> GiNaC::exhashmap<(int)>""" 01217 return _SyFi.count_symbols(*args) 01218 def extract_symbols(*args):
GiNaC::exhashmap<int> SyFi::count_symbols | ( | const GiNaC::ex & | e | ) |
exhashmap<int> SyFi::count_symbols | ( | const ex & | e | ) |
Definition at line 1153 of file ginac_tools.cpp.
References SyFi::SymbolCounterVisitor::symbolcount.
Referenced by _wrap_count_symbols(), and print().
01154 { 01155 SymbolCounterVisitor v; 01156 e.traverse(v); 01157 return v.symbolcount; 01158 }
def SyFi::cross | ( | args | ) |
cross(GiNaC::lst v1, GiNaC::lst v2) -> GiNaC::lst
Definition at line 1127 of file SyFi.py.
01127 : 01128 """cross(GiNaC::lst v1, GiNaC::lst v2) -> GiNaC::lst""" 01129 return _SyFi.cross(*args) 01130 def ex2equations(*args):
Definition at line 90 of file Ptv_tools.cpp.
References Ptv::redim(), and Ptv::size().
00091 { 00092 if ( a.size() != b.size() ) 00093 { 00094 throw(std::logic_error("Exception from cross (const Ptv&, const Ptv&, Ptv&): The dimentions of a and b must be the same.")); 00095 } 00096 00097 if ( a.size() == 2 ) 00098 { 00099 c.redim(1); 00100 c[0] = a[0]*b[1] - a[1]*b[0]; 00101 } 00102 00103 else if ( a.size() == 3 ) 00104 { 00105 c.redim(3); 00106 c[0] = a[1]*b[2] - b[1]*a[2]; 00107 c[1] = - a[0]*b[2] + b[0]*a[2]; 00108 c[2] = a[0]*b[1] - b[0]*a[1]; 00109 } 00110 00111 else 00112 { 00113 throw(std::logic_error("The cross product can only be computed in 2D and 3D.")); 00114 } 00115 00116 }
GiNaC::lst SyFi::cross | ( | GiNaC::lst & | v1, | |
GiNaC::lst & | v2 | |||
) |
Definition at line 20 of file ginac_tools.cpp.
Referenced by _wrap_cross(), barycenter_triangle(), SyFi::Nedelec::compute_basis_functions(), line_contains(), and normal().
00021 { 00022 GiNaC::lst ret; 00023 if ( v1.nops() != v2.nops() ) 00024 { 00025 cout <<"incompatible vectors "<<endl; 00026 cout <<"v1.nops() "<<v1.nops(); 00027 cout <<" v2.nops() "<<v2.nops()<<endl; ; 00028 return GiNaC::lst(); 00029 } 00030 ret.append( v1.op(1)*v2.op(2) - v1.op(2)*v2.op(1)); 00031 ret.append(- v1.op(0)*v2.op(2) + v1.op(2)*v2.op(0)); 00032 ret.append( v1.op(0)*v2.op(1) - v1.op(1)*v2.op(0)); 00033 return ret; 00034 }
int SyFi::dirac | ( | unsigned int | i, | |
unsigned int | j | |||
) |
def SyFi::dirac | ( | args | ) |
dirac(unsigned int i, unsigned int j) -> int
Definition at line 1107 of file SyFi.py.
Referenced by _wrap_dirac(), SyFi::CrouzeixRaviart::compute_basis_functions(), and main().
01107 : 01108 """dirac(unsigned int i, unsigned int j) -> int""" 01109 return _SyFi.dirac(*args) 01110 def int2string(*args):
def SyFi::div | ( | args | ) |
div(GiNaC::lst v) -> GiNaC::ex div(GiNaC::lst v, GiNaC::ex G) -> GiNaC::ex div(GiNaC::ex v) -> GiNaC::ex div(GiNaC::ex v, GiNaC::ex G) -> GiNaC::ex
Definition at line 1269 of file SyFi.py.
01269 : 01270 """ 01271 div(GiNaC::lst v) -> GiNaC::ex 01272 div(GiNaC::lst v, GiNaC::ex G) -> GiNaC::ex 01273 div(GiNaC::ex v) -> GiNaC::ex 01274 div(GiNaC::ex v, GiNaC::ex G) -> GiNaC::ex 01275 """ 01276 return _SyFi.div(*args) 01277 def grad(*args):
GiNaC::ex SyFi::div | ( | GiNaC::exvector & | v | ) |
Definition at line 212 of file diff_tools.cpp.
00213 { 00214 using SyFi::nsd; 00215 using SyFi::x; 00216 using SyFi::y; 00217 using SyFi::z; 00218 00219 GiNaC::ex ret; 00220 if (nsd == 2) 00221 { 00222 ret = v[0].diff(x) + v[1].diff(y); 00223 } 00224 else if (nsd == 3) 00225 { 00226 ret = v[0].diff(x) + v[1].diff(y) + v[2].diff(z); 00227 } 00228 return ret; 00229 }
GiNaC::ex SyFi::div | ( | GiNaC::lst & | v, | |
GiNaC::ex | G | |||
) |
Definition at line 169 of file diff_tools.cpp.
00170 { 00171 using SyFi::x; 00172 using SyFi::y; 00173 using SyFi::z; 00174 00175 using SyFi::nsd; 00176 nsd = v.nops(); 00177 GiNaC::ex ret; 00178 if (GiNaC::is_a<GiNaC::matrix>(G)) 00179 { 00180 GiNaC::matrix GG = GiNaC::ex_to<GiNaC::matrix>(G); 00181 if ( nsd != GG.cols() || nsd != GG.rows()) 00182 { 00183 throw(std::invalid_argument("The number of rows and cols in G must equal the size of v.")); 00184 } 00185 if (nsd == 1 || nsd == 2 || nsd == 3 ) 00186 { 00187 GiNaC::symbol xj; 00188 ret = GiNaC::numeric(0); 00189 for (unsigned int i=0; i< nsd; i++) 00190 { 00191 for (unsigned int j=0; j< nsd; j++) 00192 { 00193 if (i == 0) xj = x; 00194 if (i == 1) xj = y; 00195 if (i == 2) xj = z; 00196 ret += v.op(i).diff(xj)*GG(i,j); 00197 } 00198 } 00199 } 00200 else 00201 { 00202 throw std::runtime_error("Invalid nsd"); 00203 } 00204 } 00205 else 00206 { 00207 throw std::invalid_argument("v must be a matrix."); 00208 } 00209 return ret; 00210 }
GiNaC::ex SyFi::div | ( | GiNaC::lst & | v | ) |
Definition at line 145 of file diff_tools.cpp.
00146 { 00147 using SyFi::x; 00148 using SyFi::y; 00149 using SyFi::z; 00150 00151 using SyFi::nsd; 00152 nsd = v.nops(); 00153 GiNaC::ex ret; 00154 if (nsd == 1) 00155 { 00156 ret = v.op(0).diff(x); 00157 } 00158 else if (nsd == 2) 00159 { 00160 ret = v.op(0).diff(x) + v.op(1).diff(y); 00161 } 00162 else if (nsd == 3) 00163 { 00164 ret = v.op(0).diff(x) + v.op(1).diff(y) + v.op(2).diff(z); 00165 } 00166 return ret; 00167 }
GiNaC::ex SyFi::div | ( | GiNaC::ex | v, | |
GiNaC::ex | G | |||
) |
Definition at line 94 of file diff_tools.cpp.
References div(), SyFi_polygons::spacetimedomain::l, run::m, nsd, x, y, and z.
00095 { 00096 using SyFi::nsd; 00097 using SyFi::x; 00098 using SyFi::y; 00099 using SyFi::z; 00100 00101 GiNaC::ex ret; 00102 if (GiNaC::is_a<GiNaC::matrix>(v) && GiNaC::is_a<GiNaC::matrix>(G)) 00103 { 00104 GiNaC::matrix m = GiNaC::ex_to<GiNaC::matrix>(v); 00105 GiNaC::matrix GG = GiNaC::ex_to<GiNaC::matrix>(G); 00106 if ( m.cols() == 1 && m.rows() == nsd && GG.rows() == nsd && GG.cols() == nsd ) 00107 { 00108 if ( nsd == 1 || nsd == 2 || nsd == 3) 00109 { 00110 ret = GiNaC::numeric(0); 00111 GiNaC::symbol xj; 00112 for (unsigned int i=0; i< nsd; i++) 00113 { 00114 for (unsigned int j=0; j< nsd; j++) 00115 { 00116 if (j == 0) xj = x; 00117 if (j == 1) xj = y; 00118 if (j == 2) xj = z; 00119 ret += m.op(i).diff(xj)*GG(i,j); 00120 } 00121 } 00122 } 00123 else 00124 { 00125 throw std::runtime_error("Invalid nsd"); 00126 } 00127 } 00128 else 00129 { 00130 throw std::invalid_argument("This functions needs v and G on the form: v.cols()=1, v.rows()=G.rows()=G.cols()=nsd."); 00131 } 00132 } 00133 else if (GiNaC::is_a<GiNaC::lst>(v)) 00134 { 00135 GiNaC::lst l = GiNaC::ex_to<GiNaC::lst>(v); 00136 return div(l,G); 00137 } 00138 else 00139 { 00140 throw std::invalid_argument("v must be a matrix or lst."); 00141 } 00142 return ret; 00143 }
GiNaC::ex SyFi::div | ( | GiNaC::ex | v | ) |
Definition at line 31 of file diff_tools.cpp.
References SyFi_polygons::spacetimedomain::l, run::m, nsd, x, y, and z.
Referenced by _wrap_div__SWIG_0(), _wrap_div__SWIG_1(), _wrap_div__SWIG_2(), _wrap_div__SWIG_3(), SyFi::Robust::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), compute_mixed_Poisson_element_matrix(), compute_Stokes_element_matrix(), div(), and main().
00032 { 00033 using SyFi::nsd; 00034 using SyFi::x; 00035 using SyFi::y; 00036 using SyFi::z; 00037 00038 GiNaC::ex ret; 00039 if (GiNaC::is_a<GiNaC::matrix>(v)) 00040 { 00041 GiNaC::matrix m = GiNaC::ex_to<GiNaC::matrix>(v); 00042 if ( m.cols() == 1 && m.rows() == nsd ) 00043 { 00044 if (nsd == 1) 00045 { 00046 ret = diff(m,x); 00047 } 00048 else if (nsd == 2) 00049 { 00050 ret = diff(m.op(0),x) + diff(m.op(1),y) ; 00051 } 00052 else if (nsd == 3) 00053 { 00054 ret = diff(m.op(0),x) + diff(m.op(1),y) + diff(m.op(2),z) ; 00055 } 00056 else 00057 { 00058 throw std::runtime_error("Invalid nsd"); 00059 } 00060 00061 } 00062 else 00063 { 00064 GiNaC::matrix retm = GiNaC::matrix(m.cols(),1); 00065 if ( nsd != m.rows() ) 00066 { 00067 throw(std::invalid_argument("The number of rows must equal nsd.")); 00068 } 00069 GiNaC::symbol xr; 00070 GiNaC::ex tmp; 00071 for (unsigned int c=0; c<m.cols(); c++) 00072 { 00073 for (unsigned int r=0; r<m.rows(); r++) 00074 { 00075 if (r+1 == 1) xr = x; 00076 if (r+1 == 2) xr = y; 00077 if (r+1 == 3) xr = z; 00078 retm(c,0) += diff(m(c,r), xr); 00079 } 00080 } 00081 ret = retm; 00082 } 00083 return ret; 00084 00085 } 00086 else if (GiNaC::is_a<GiNaC::lst>(v)) 00087 { 00088 GiNaC::lst l = GiNaC::ex_to<GiNaC::lst>(v); 00089 return div(l); 00090 } 00091 throw std::invalid_argument("v must be a matrix or lst."); 00092 }
GiNaC::symbol SyFi::DUMMY | ( | "(DUMMY is not initialized since initSyFi has never been called)" | ) |
def SyFi::EQUAL_OR_DIE | ( | args | ) |
void SyFi::EQUAL_OR_DIE | ( | const GiNaC::ex & | e, | |
const std::string & | s | |||
) |
void SyFi::EQUAL_OR_DIE | ( | const ex & | e, | |
const string & | s | |||
) |
Definition at line 1081 of file ginac_tools.cpp.
References compare().
Referenced by _wrap_EQUAL_OR_DIE(), and main().
01082 { 01083 if (!compare(e, s)) 01084 { 01085 ostringstream os; 01086 os << "ERROR: expression e: " <<e<<" is not equal to "<<s<<endl; 01087 throw runtime_error(os.str()); 01088 } 01089 }
def SyFi::equations2matrix | ( | args | ) |
equations2matrix(GiNaC::ex eqns, GiNaC::ex symbols) -> GiNaC::matrix
Definition at line 1139 of file SyFi.py.
01139 : 01140 """equations2matrix(GiNaC::ex eqns, GiNaC::ex symbols) -> GiNaC::matrix""" 01141 return _SyFi.equations2matrix(*args) 01142 def matrix_from_equations(*args):
GiNaC::matrix SyFi::equations2matrix | ( | const GiNaC::ex & | eqns, | |
const GiNaC::ex & | symbols | |||
) |
Definition at line 224 of file ginac_tools.cpp.
Referenced by _wrap_equations2matrix().
00225 { 00226 00227 GiNaC::matrix sys(eqns.nops(),symbols.nops()); 00228 GiNaC::matrix rhs(eqns.nops(),1); 00229 GiNaC::matrix vars(symbols.nops(),1); 00230 00231 for (size_t r=0; r<eqns.nops(); r++) 00232 { 00233 // lhs-rhs==0 00234 const GiNaC::ex eq = eqns.op(r).op(0)-eqns.op(r).op(1); 00235 GiNaC::ex linpart = eq; 00236 for (size_t c=0; c<symbols.nops(); c++) 00237 { 00238 const GiNaC::ex co = eq.coeff(GiNaC::ex_to<GiNaC::symbol>(symbols.op(c)),1); 00239 linpart -= co*symbols.op(c); 00240 sys(r,c) = co; 00241 } 00242 linpart = linpart.expand(); 00243 rhs(r,0) = -linpart; 00244 } 00245 return sys; 00246 }
def SyFi::ex2equations | ( | args | ) |
GiNaC::lst SyFi::ex2equations | ( | GiNaC::ex | rel | ) |
Definition at line 173 of file ginac_tools.cpp.
References SyFi_polygons::spacetimedomain::l, x, y, and z.
Referenced by _wrap_ex2equations().
00174 { 00175 GiNaC::ex lhs = rel.lhs(); 00176 GiNaC::ex rhs = rel.rhs(); 00177 00178 GiNaC::ex l; 00179 GiNaC::ex r; 00180 00181 GiNaC::lst eqs; 00182 00183 for (int i=lhs.ldegree(x); i<=lhs.degree(x); ++i) 00184 { 00185 for (int j=lhs.ldegree(y); j<=lhs.degree(y); ++j) 00186 { 00187 for (int k=lhs.ldegree(z); k<=lhs.degree(z); ++k) 00188 { 00189 l = lhs.coeff(x,i).coeff(y, j).coeff(z,k); 00190 r = rhs.coeff(x,i).coeff(y, j).coeff(z,k); 00191 // if (! (l == 0 && r == 0 ) ) eqs.append(l == r); OLD VERSION 00192 if ( (l != 0 && (r == 0 || r == 1) ) ) eqs.append(l == r); 00193 } 00194 } 00195 } 00196 eqs.sort(); 00197 return eqs; 00198 }
def SyFi::extract_symbols | ( | args | ) |
GiNaC::ex SyFi::extract_symbols | ( | const GiNaC::ex & | e | ) |
ex SyFi::extract_symbols | ( | const ex & | e | ) |
Definition at line 1201 of file ginac_tools.cpp.
References SyFi_polygons::spacetimedomain::l, and SyFi::SymbolCounterVisitor::symbolcount.
Referenced by _wrap_extract_symbols(), and compare_archives().
01202 { 01203 // Implemented directly to avoid copying map: 01204 SymbolCounterVisitor v; 01205 e.traverse(v); 01206 exhashmap<int> & sc = v.symbolcount; 01207 01208 lst l; 01209 for(exhashmap<int>::iterator it=sc.begin(); it!=sc.end(); it++) 01210 { 01211 l.append(it->first); 01212 std::cout << (it->first) << std::endl; 01213 } 01214 ex ret = l; 01215 return ret; 01216 }
string SyFi::exvector2string | ( | GiNaC::exvector & | v | ) |
Definition at line 63 of file utilities.cpp.
References run::s.
00064 { 00065 ostringstream s; 00066 s <<"["; 00067 for (unsigned int i=0; i< v.size()-1; i++) 00068 { 00069 s <<v[i]<<","; 00070 } 00071 s<<v[v.size()-1]<< "]"; 00072 return s.str(); 00073 }
def SyFi::find | ( | args | ) |
find(GiNaC::ex e, GiNaC::lst list) -> int
Definition at line 1162 of file SyFi.py.
01162 : 01163 """find(GiNaC::ex e, GiNaC::lst list) -> int""" 01164 return _SyFi.find(*args) 01165 def check_visitor(*args):
int SyFi::find | ( | GiNaC::ex | e, | |
GiNaC::lst | list | |||
) |
Definition at line 376 of file ginac_tools.cpp.
Referenced by _wrap_ex_int_map_find(), _wrap_exmap_find(), _wrap_exset_find(), _wrap_find(), and check_visitor().
00377 { 00378 for (unsigned int i=0; i< list.nops(); i++) 00379 { 00380 if ( e == list.op(i) ) return i; 00381 } 00382 return -1; 00383 }
const GiNaC::symbol& SyFi::get_symbol | ( | const std::string & | name | ) |
const symbol& SyFi::get_symbol | ( | const string & | name | ) |
Definition at line 109 of file syfi/symbol_factory.cpp.
References symbol_collection.
00110 { 00111 map<string, symbol>::iterator i = symbol_collection.find(name); 00112 if( i != symbol_collection.end() ) 00113 { 00114 return i->second; 00115 } 00116 return symbol_collection.insert(make_pair(name, symbol(name))).first->second; 00117 }
def SyFi::get_symbol | ( | args | ) |
get_symbol(string name) -> GiNaC::symbol
Definition at line 1342 of file SyFi.py.
Referenced by _wrap_get_symbol(), initSyFi(), isymb(), main(), pickExpression(), and replace_powers().
01342 : 01343 """get_symbol(string name) -> GiNaC::symbol""" 01344 return _SyFi.get_symbol(*args) 01345 def get_symbolic_vector(*args):
GiNaC::ex SyFi::get_symbolic_matrix | ( | int | m, | |
int | n, | |||
const std::string & | basename | |||
) |
Definition at line 140 of file syfi/symbol_factory.cpp.
References test::e, and isymb().
00141 { 00142 GiNaC::matrix A(m,n); 00143 for(int i=0; i<m; i++) 00144 { 00145 for(int j=0; j<n; j++) 00146 { 00147 A.set(i, j, isymb(basename, i,j)); 00148 } 00149 } 00150 GiNaC::ex e = A; 00151 return e; 00152 }
def SyFi::get_symbolic_matrix | ( | args | ) |
get_symbolic_matrix(int m, int n, string basename) -> GiNaC::ex
Definition at line 1350 of file SyFi.py.
Referenced by _wrap_get_symbolic_matrix(), bernstein(), homogenous_pol(), lagrange(), lagrangev(), legendre(), main(), pol(), and polb().
01350 : 01351 """get_symbolic_matrix(int m, int n, string basename) -> GiNaC::ex""" 01352 return _SyFi.get_symbolic_matrix(*args) SUBS_PERFORMED = _SyFi.SUBS_PERFORMED
GiNaC::ex SyFi::get_symbolic_vector | ( | int | m, | |
const std::string & | basename | |||
) |
def SyFi::get_symbolic_vector | ( | args | ) |
get_symbolic_vector(int m, string basename) -> GiNaC::ex
Definition at line 1346 of file SyFi.py.
Referenced by _wrap_get_symbolic_vector(), barycenter(), initSyFi(), main(), and SyFi::Simplex::repr().
01346 : 01347 """get_symbolic_vector(int m, string basename) -> GiNaC::ex""" 01348 return _SyFi.get_symbolic_vector(*args) 01349 def get_symbolic_matrix(*args):
def SyFi::grad | ( | args | ) |
grad(GiNaC::ex f) -> GiNaC::ex grad(GiNaC::ex f, GiNaC::ex G) -> GiNaC::ex
Definition at line 1278 of file SyFi.py.
01278 : 01279 """ 01280 grad(GiNaC::ex f) -> GiNaC::ex 01281 grad(GiNaC::ex f, GiNaC::ex G) -> GiNaC::ex 01282 """ 01283 return _SyFi.grad(*args) 01284 def compare_archives(*args):
GiNaC::ex SyFi::grad | ( | GiNaC::ex | f, | |
GiNaC::ex | G | |||
) |
Definition at line 287 of file diff_tools.cpp.
References run::m, nsd, x, y, and z.
00288 { 00289 using SyFi::nsd; 00290 using SyFi::x; 00291 using SyFi::y; 00292 using SyFi::z; 00293 00294 GiNaC::symbol xr; 00295 if ( GiNaC::is_a<GiNaC::matrix>(G)) 00296 { 00297 GiNaC::matrix GG = GiNaC::ex_to<GiNaC::matrix>(G); 00298 00299 if (! (GG.rows() == nsd && GG.cols() == nsd )) 00300 { 00301 throw(std::invalid_argument("The number of cols/rows in G must equal nsd.")); 00302 } 00303 00304 if (GiNaC::is_a<GiNaC::matrix>(f) ) 00305 { 00306 GiNaC::matrix m = GiNaC::ex_to<GiNaC::matrix>(f); 00307 GiNaC::matrix ret_m(nsd,m.rows()); 00308 for (unsigned int k=0; k< m.rows(); k++) 00309 { 00310 for (unsigned int c=0; c<nsd; c++) 00311 { 00312 for (unsigned int r=0; r<nsd; r++) 00313 { 00314 if (r == 0) xr = x; 00315 if (r == 1) xr = y; 00316 if (r == 2) xr = z; 00317 ret_m(c,k) += diff(f,xr)*GG(r,c); 00318 } 00319 } 00320 } 00321 00322 return ret_m; 00323 } 00324 else 00325 { 00326 GiNaC::matrix ret_m(nsd,1); 00327 for (unsigned int c=0; c<nsd; c++) 00328 { 00329 for (unsigned int r=0; r<nsd; r++) 00330 { 00331 if (r == 0) xr = x; 00332 if (r == 1) xr = y; 00333 if (r == 2) xr = z; 00334 ret_m(c,0) += diff(f,xr)*GG(r,c); 00335 } 00336 } 00337 return ret_m; 00338 } 00339 } 00340 else 00341 { 00342 throw(std::invalid_argument("G must be a matrix.")); 00343 } 00344 }
GiNaC::ex SyFi::grad | ( | GiNaC::ex | f | ) |
Definition at line 231 of file diff_tools.cpp.
References run::m, nsd, x, y, and z.
Referenced by _wrap_grad__SWIG_0(), _wrap_grad__SWIG_1(), compute_nlconvdiff_element_matrix(), compute_poisson_element_matrix(), compute_Poisson_element_matrix(), compute_Poisson_element_matrix(), compute_Stokes_element_matrix(), example_of_use(), main(), and usage().
00232 { 00233 using SyFi::nsd; 00234 using SyFi::x; 00235 using SyFi::y; 00236 using SyFi::z; 00237 00238 if (GiNaC::is_a<GiNaC::matrix>(f)) 00239 { 00240 GiNaC::matrix m = GiNaC::ex_to<GiNaC::matrix>(f); 00241 GiNaC::matrix ret_m(nsd,m.rows()); 00242 for (unsigned int r=0; r< m.rows(); r++) 00243 { 00244 if (nsd == 1) 00245 { 00246 // ret_m(0,r) = diff(m.op(r),x); 00247 return diff(f, x); 00248 } 00249 else if ( nsd == 2) 00250 { 00251 ret_m(0,r) = diff(m.op(r),x); 00252 ret_m(1,r) = diff(m.op(r),y); 00253 } 00254 else if ( nsd == 3) 00255 { 00256 ret_m(0,r) = diff(m.op(r),x); 00257 ret_m(1,r) = diff(m.op(r),y); 00258 ret_m(2,r) = diff(m.op(r),z); 00259 } 00260 } 00261 return ret_m; 00262 } 00263 else 00264 { 00265 00266 if (nsd == 1) 00267 { 00268 // return GiNaC::matrix(nsd,1,GiNaC::lst(diff(f,x))); 00269 return diff(f,x); 00270 } 00271 else if ( nsd == 2) 00272 { 00273 return GiNaC::matrix(nsd,1,GiNaC::lst(diff(f,x), diff(f,y))); 00274 } 00275 else if ( nsd == 3) 00276 { 00277 return GiNaC::matrix(nsd,1,GiNaC::lst(diff(f,x), diff(f,y), diff(f,z))); 00278 } 00279 else 00280 { 00281 throw(std::invalid_argument("nsd must be either 1, 2, or 3.")); 00282 return GiNaC::matrix(); 00283 } 00284 } 00285 }
def SyFi::homogenous_pol | ( | args | ) |
homogenous_pol(unsigned int order, unsigned int nsd, string a) -> GiNaC::ex
Definition at line 1189 of file SyFi.py.
01189 : 01190 """homogenous_pol(unsigned int order, unsigned int nsd, string a) -> GiNaC::ex""" 01191 return _SyFi.homogenous_pol(*args) 01192 def homogenous_polv(*args):
GiNaC::ex SyFi::homogenous_pol | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const std::string | a | |||
) |
GiNaC::ex SyFi::homogenous_pol | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const string | a | |||
) |
Definition at line 520 of file ginac_tools.cpp.
References get_symbolic_matrix(), istr(), matrix_to_lst2(), x, y, and z.
Referenced by _wrap_homogenous_pol(), homogenous_polv(), and main().
00521 { 00522 using SyFi::x; 00523 using SyFi::y; 00524 using SyFi::z; 00525 00526 if ( nsd == 1) 00527 { 00528 GiNaC::symbol a0(istr(a,0)); 00529 return GiNaC::lst(a0*pow(x,order), a0, pow(x,order)); 00530 } 00531 else if ( nsd == 2 ) 00532 { 00533 GiNaC::ex variables = get_symbolic_matrix(1,order+1, a); 00534 GiNaC::lst basis; 00535 GiNaC::ex ret; 00536 for (unsigned int i=0; i<= order; i++) 00537 { 00538 basis.append(pow(x,i)*pow(y,order-i)); 00539 ret += variables.op(i)*basis.op(i); 00540 } 00541 return GiNaC::lst(ret, matrix_to_lst2(variables), basis); 00542 } 00543 else if ( nsd == 3 ) 00544 { 00545 GiNaC::lst basis; 00546 for (unsigned int i=0; i<= order; i++) 00547 { 00548 for (unsigned int j=0; j<= order; j++) 00549 { 00550 for (unsigned int k=0; k<= order; k++) 00551 { 00552 if ( i + j + k == order ) 00553 { 00554 basis.append(pow(x,i)*pow(y,j)*pow(z,k)); 00555 } 00556 } 00557 } 00558 } 00559 GiNaC::ex variables = get_symbolic_matrix(1,basis.nops(), a); 00560 GiNaC::ex ret; 00561 for (unsigned int i=0; i<basis.nops(); i++) 00562 { 00563 ret += variables.op(i)*basis.op(i); 00564 } 00565 return GiNaC::lst(ret, matrix_to_lst2(variables), basis); 00566 } 00567 throw std::runtime_error("Homogenous polynomials only implemented in 1D, 2D and 3D"); 00568 }
def SyFi::homogenous_polv | ( | args | ) |
homogenous_polv(unsigned int no_fields, unsigned int order, unsigned int nsd, string a) -> GiNaC::lst
Definition at line 1193 of file SyFi.py.
01193 : 01194 """ 01195 homogenous_polv(unsigned int no_fields, unsigned int order, unsigned int nsd, 01196 string a) -> GiNaC::lst 01197 """ 01198 return _SyFi.homogenous_polv(*args) 01199 def legendre(*args):
GiNaC::lst SyFi::homogenous_polv | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
unsigned int | nsd, | |||
const std::string | a | |||
) |
GiNaC::lst SyFi::homogenous_polv | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
unsigned int | nsd, | |||
const string | a | |||
) |
Definition at line 571 of file ginac_tools.cpp.
References homogenous_pol(), and run::s.
Referenced by _wrap_homogenous_polv(), SyFi::Nedelec2Hdiv::compute_basis_functions(), and SyFi::Nedelec::compute_basis_functions().
00572 { 00573 GiNaC::lst ret1; // contains the polynom 00574 GiNaC::lst ret2; // contains the coefficients 00575 GiNaC::lst ret3; // constains the basis functions 00576 GiNaC::lst basis_tmp; 00577 for (unsigned int i=0; i< no_fields; i++) 00578 { 00579 GiNaC::lst basis; 00580 std::ostringstream s; 00581 s <<a<<""<<i<<"_"; 00582 GiNaC::ex polspace = homogenous_pol(order, nsd, s.str()); 00583 ret1.append(polspace.op(0)); 00584 ret2.append(polspace.op(1)); 00585 basis_tmp = GiNaC::ex_to<GiNaC::lst>(polspace.op(2)); 00586 for (GiNaC::lst::const_iterator basis_iterator = basis_tmp.begin(); 00587 basis_iterator != basis_tmp.end(); ++basis_iterator) 00588 { 00589 GiNaC::lst tmp_lst; 00590 for (unsigned int d=1; d<=no_fields; d++) tmp_lst.append(0); 00591 tmp_lst.let_op(i) = (*basis_iterator); 00592 ret3.append(tmp_lst); 00593 } 00594 } 00595 return GiNaC::lst(ret1,ret2,ret3); 00596 }
GiNaC::symbol SyFi::infinity | ( | "(infinity is not initialized since initSyFi has never been called)" | ) |
void SyFi::initSyFi | ( | unsigned int | nsd_ | ) |
Definition at line 32 of file syfi/symbol_factory.cpp.
References DUMMY, get_symbol(), get_symbolic_vector(), infinity, nsd, p, t, x, y, and z.
00033 { 00034 // initSyFi uses the global coordinates x for nsd == 1 00035 // initSyFi uses the global coordinates x,y for nsd == 2 00036 // initSyFi uses the global coordinates x,y,z for nsd == 3 00037 // when nsd > 3 the coordinates can be found in the p, which is of type lst 00038 00039 // FIXME: this whole thing is just a mess, but it's a nontrivial job to fix it all over syfi... 00040 00041 SyFi::nsd = nsd_; 00042 SyFi::t = get_symbol("t"); 00043 00044 SyFi::infinity = get_symbol("infinity"); 00045 SyFi::DUMMY = get_symbol("DUMMY"); 00046 00047 SyFi::x = get_symbol("(SyFi::x is not initialized)"); 00048 SyFi::y = get_symbol("(SyFi::y is not initialized)"); 00049 SyFi::z = get_symbol("(SyFi::z is not initialized)"); 00050 00051 /* 00052 std::cout << "SyFi::p before remove_all:" << std::endl; 00053 std::cout << SyFi::p << std::endl; 00054 */ 00055 00056 SyFi::p.remove_all(); 00057 00058 /* 00059 std::cout << "SyFi::p after remove_all:" << std::endl; 00060 std::cout << SyFi::p << std::endl; 00061 */ 00062 00063 if ( nsd > 3 ) 00064 { 00065 SyFi::x = get_symbol("(SyFi::x is an invalid symbol when nsd>3)"); 00066 SyFi::y = get_symbol("(SyFi::y is an invalid symbol when nsd>3)"); 00067 SyFi::z = get_symbol("(SyFi::z is an invalid symbol when nsd>3)"); 00068 00069 ex tmp = get_symbolic_vector(nsd, "x"); 00070 for (unsigned int i=0; i<tmp.nops(); i++) 00071 { 00072 p.append(tmp.op(i)); 00073 } 00074 } 00075 else 00076 { 00077 if ( nsd > 0 ) 00078 { 00079 SyFi::x = get_symbol("x"); 00080 SyFi::p.append(SyFi::x); 00081 } 00082 if ( nsd > 1 ) 00083 { 00084 SyFi::y = get_symbol("y"); 00085 SyFi::p.append(SyFi::y); 00086 } 00087 if ( nsd > 2 ) 00088 { 00089 SyFi::z = get_symbol("z"); 00090 SyFi::p.append(SyFi::z); 00091 } 00092 } 00093 00094 /* 00095 std::cout << "SyFi::p at end of initSyFi:" << std::endl; 00096 std::cout << SyFi::p << std::endl; 00097 */ 00098 }
def SyFi::initSyFi | ( | args | ) |
initSyFi(unsigned int nsd)
Definition at line 1334 of file SyFi.py.
Referenced by _wrap_initSyFi(), check_CrouzeixRaviart(), check_RaviartThomas(), and main().
01334 : 01335 """initSyFi(unsigned int nsd)""" 01336 return _SyFi.initSyFi(*args) 01337 def symbol_exists(*args):
def SyFi::inner | ( | args | ) |
inner(GiNaC::ex a, GiNaC::ex b, bool transposed = False) -> GiNaC::ex inner(GiNaC::ex a, GiNaC::ex b) -> GiNaC::ex inner(GiNaC::exvector v1, GiNaC::exvector v2) -> GiNaC::ex inner(GiNaC::lst v1, GiNaC::lst v2) -> GiNaC::ex
Definition at line 1292 of file SyFi.py.
01292 : 01293 """ 01294 inner(GiNaC::ex a, GiNaC::ex b, bool transposed = False) -> GiNaC::ex 01295 inner(GiNaC::ex a, GiNaC::ex b) -> GiNaC::ex 01296 inner(GiNaC::exvector v1, GiNaC::exvector v2) -> GiNaC::ex 01297 inner(GiNaC::lst v1, GiNaC::lst v2) -> GiNaC::ex 01298 """ 01299 return _SyFi.inner(*args) 01300 def matvec(*args):
GiNaC::ex SyFi::inner | ( | GiNaC::exvector & | v1, | |
GiNaC::exvector & | v2 | |||
) |
Definition at line 129 of file ginac_tools.cpp.
00130 { 00131 GiNaC::ex ret; 00132 for (unsigned int i=0; i< v1.size(); i++) 00133 { 00134 ret += v1[i]*v2[i]; 00135 } 00136 return ret; 00137 }
GiNaC::ex SyFi::inner | ( | GiNaC::lst | v1, | |
GiNaC::lst | v2 | |||
) |
Definition at line 102 of file ginac_tools.cpp.
References inner().
00103 { 00104 GiNaC::ex ret; 00105 00106 if ( v1.nops() != v2.nops() ) 00107 { 00108 cout <<"incompatible vectors "<<endl; 00109 cout <<"v1.nops() "<<v1.nops(); 00110 cout <<" v2.nops() "<<v2.nops()<<endl; ; 00111 return 0; 00112 } 00113 for (unsigned i = 0; i <= v1.nops()-1 ; ++i) 00114 { 00115 if ( GiNaC::is_a<GiNaC::lst>(v1.op(i)) && 00116 GiNaC::is_a<GiNaC::lst>(v2.op(i)) ) 00117 { 00118 ret += inner(GiNaC::ex_to<GiNaC::lst>(v1.op(i)), 00119 GiNaC::ex_to<GiNaC::lst>(v2.op(i))); 00120 } 00121 else 00122 { 00123 ret += v1.op(i)*v2.op(i); 00124 } 00125 } 00126 return ret; 00127 }
GiNaC::ex SyFi::inner | ( | GiNaC::ex | a, | |
GiNaC::ex | b, | |||
bool | transposed | |||
) |
Definition at line 36 of file ginac_tools.cpp.
Referenced by _wrap_inner__SWIG_0(), _wrap_inner__SWIG_1(), _wrap_inner__SWIG_2(), _wrap_inner__SWIG_3(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), compute_mixed_Poisson_element_matrix(), compute_nlconvdiff_element_matrix(), compute_poisson_element_matrix(), compute_Poisson_element_matrix(), compute_Poisson_element_matrix(), compute_Stokes_element_matrix(), inner(), and main().
00037 { 00038 if (GiNaC::is_a<GiNaC::matrix>(a) && GiNaC::is_a<GiNaC::matrix>(b)) 00039 { 00040 GiNaC::matrix ma = GiNaC::ex_to<GiNaC::matrix>(a); 00041 GiNaC::matrix mb = GiNaC::ex_to<GiNaC::matrix>(b); 00042 if ( !transposed ) 00043 { 00044 if (ma.cols() != mb.cols() || ma.rows() != mb.rows() ) 00045 { 00046 cout <<"Incompatible matrices "<<endl; 00047 cout <<"a.cols() "<<ma.cols()<<endl; 00048 cout <<"a.rows() "<<ma.rows()<<endl; 00049 cout <<"b.cols() "<<mb.cols()<<endl; 00050 cout <<"b.rows() "<<mb.rows()<<endl; 00051 cout <<"a="<<a<<endl; 00052 cout <<"b="<<b<<endl; 00053 throw std::runtime_error("Incompatible matrices."); 00054 } 00055 00056 GiNaC::ex ret; 00057 for (unsigned int i=0; i<ma.rows(); i++) 00058 { 00059 for (unsigned int j=0; j<ma.cols(); j++) 00060 { 00061 ret += ma(i,j)*mb(i,j); 00062 } 00063 } 00064 return ret; 00065 } 00066 else 00067 { 00068 if (ma.cols() != mb.rows() || ma.rows() != mb.cols() ) 00069 { 00070 cout <<"Incompatible matrices "<<endl; 00071 cout <<"a.cols() "<<ma.cols()<<endl; 00072 cout <<"a.rows() "<<ma.rows()<<endl; 00073 cout <<"b.cols() "<<mb.cols()<<endl; 00074 cout <<"b.rows() "<<mb.rows()<<endl; 00075 cout <<"a="<<a<<endl; 00076 cout <<"b="<<b<<endl; 00077 throw std::runtime_error("Incompatible matrices."); 00078 } 00079 00080 GiNaC::ex ret; 00081 for (unsigned int i=0; i<ma.rows(); i++) 00082 { 00083 for (unsigned int j=0; j<ma.cols(); j++) 00084 { 00085 ret += ma(i,j)*mb(j,i); 00086 } 00087 } 00088 return ret; 00089 } 00090 } 00091 else if (GiNaC::is_a<GiNaC::lst>(a) 00092 && GiNaC::is_a<GiNaC::lst>(b)) 00093 { 00094 return inner(GiNaC::ex_to<GiNaC::lst>(a), GiNaC::ex_to<GiNaC::lst>(b)); 00095 } 00096 else 00097 { 00098 return a*b; 00099 } 00100 }
std::string SyFi::int2string | ( | int | i | ) |
def SyFi::int2string | ( | args | ) |
int2string(int i) -> string
Definition at line 1111 of file SyFi.py.
Referenced by _wrap_int2string(), and replace_powers().
01111 : 01112 """int2string(int i) -> string""" 01113 return _SyFi.int2string(*args) 01114 def lst2string(*args):
def SyFi::interior_coordinates | ( | args | ) |
interior_coordinates(Line line, unsigned int d) -> GiNaC::lst interior_coordinates(Triangle triangle, unsigned int d) -> GiNaC::lst interior_coordinates(Tetrahedron tetrahedra, unsigned int d) -> GiNaC::lst
Definition at line 2038 of file SyFi.py.
02038 : 02039 """ 02040 interior_coordinates(Line line, unsigned int d) -> GiNaC::lst 02041 interior_coordinates(Triangle triangle, unsigned int d) -> GiNaC::lst 02042 interior_coordinates(Tetrahedron tetrahedra, unsigned int d) -> GiNaC::lst 02043 """ 02044 return _SyFi.interior_coordinates(*args) 02045 def normal(*args):
GiNaC::lst SyFi::interior_coordinates | ( | Line & | line, | |
unsigned int | d | |||
) |
Definition at line 1558 of file Polygon.cpp.
References lst_to_matrix2(), matrix_to_lst2(), and SyFi::Polygon::vertex().
01559 { 01560 01561 //FIXME: ugly conversion to matrix 01562 d = d+2; 01563 01564 lst ret; 01565 ex V1 = line.vertex(0); 01566 ex V2 = line.vertex(1); 01567 01568 lst V1l = ex_to<lst>(V1); 01569 lst V2l = ex_to<lst>(V2); 01570 01571 ex V1m = lst_to_matrix2(V1l); 01572 ex V2m = lst_to_matrix2(V2l); 01573 01574 int k; 01575 for (unsigned int i=1; i < d; i++) 01576 { 01577 k = d - i; 01578 ex sum = (k*V1m + i*V2m)/d; 01579 ret.append(matrix_to_lst2(sum.evalm())); 01580 } 01581 // FIXME how should these be sorted ????? 01582 // ret = ret.sort(); 01583 return ret; 01584 }
GiNaC::lst SyFi::interior_coordinates | ( | Triangle & | triangle, | |
unsigned int | d | |||
) |
Definition at line 1479 of file Polygon.cpp.
References lst_to_matrix2(), matrix_to_lst2(), and SyFi::Polygon::vertex().
01480 { 01481 01482 //FIXME: ugly conversion to matrix 01483 // 01484 d=d+3; 01485 01486 lst ret; 01487 ex V1 = triangle.vertex(0); 01488 ex V2 = triangle.vertex(1); 01489 ex V3 = triangle.vertex(2); 01490 01491 lst V1l = ex_to<lst>(V1); 01492 lst V2l = ex_to<lst>(V2); 01493 lst V3l = ex_to<lst>(V3); 01494 01495 ex V1m = lst_to_matrix2(V1l); 01496 ex V2m = lst_to_matrix2(V2l); 01497 ex V3m = lst_to_matrix2(V3l); 01498 01499 int k; 01500 for (unsigned int i=1; i < d; i++) 01501 { 01502 for (unsigned int j=1; j < d; j++) 01503 { 01504 if ( int(d) - int(i) - int(j) >= 1 ) 01505 { 01506 k = d - i - j; 01507 ex sum = (k*V1m + j*V2m + i*V3m)/d; 01508 ret.append(matrix_to_lst2(sum.evalm())); 01509 } 01510 } 01511 } 01512 // FIXME how should these be sorted ????? 01513 // ret = ret.sort(); 01514 return ret; 01515 }
GiNaC::lst SyFi::interior_coordinates | ( | Tetrahedron & | tetrahedra, | |
unsigned int | d | |||
) |
Definition at line 1400 of file Polygon.cpp.
References SyFi_polygons::spacetimedomain::l, lst_to_matrix2(), matrix_to_lst2(), and SyFi::Polygon::vertex().
Referenced by _wrap_interior_coordinates__SWIG_0(), _wrap_interior_coordinates__SWIG_1(), _wrap_interior_coordinates__SWIG_2(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), and SyFi::BrezziDouglasMarini::compute_basis_functions().
01401 { 01402 01403 //FIXME: ugly conversion to matrix 01404 d = d+4; 01405 01406 lst ret; 01407 ex V1 = tetrahedra.vertex(0); 01408 ex V2 = tetrahedra.vertex(1); 01409 ex V3 = tetrahedra.vertex(2); 01410 ex V4 = tetrahedra.vertex(3); 01411 01412 lst V1l = ex_to<lst>(V1); 01413 lst V2l = ex_to<lst>(V2); 01414 lst V3l = ex_to<lst>(V3); 01415 lst V4l = ex_to<lst>(V4); 01416 01417 ex V1m = lst_to_matrix2(V1l); 01418 ex V2m = lst_to_matrix2(V2l); 01419 ex V3m = lst_to_matrix2(V3l); 01420 ex V4m = lst_to_matrix2(V4l); 01421 01422 int l; 01423 for (unsigned int i=1; i< d; i++) 01424 { 01425 for (unsigned int j=1; j< d; j++) 01426 { 01427 for (unsigned int k=1; k< d; k++) 01428 { 01429 if ( d - i - j -k >= 1 ) 01430 { 01431 l= d - i - j -k; 01432 ex sum = (l*V1m + k*V2m + j*V3m + i*V4m)/d; 01433 ret.append(matrix_to_lst2(sum.evalm())); 01434 } 01435 } 01436 } 01437 } 01438 // FIXME how should these be sorted ????? 01439 // ret = ret.sort(); 01440 return ret; 01441 }
Definition at line 118 of file Ptv_tools.cpp.
References Ptv::size(), and Ptv::tol.
Referenced by contains3D(), and line_contains().
00119 { 00120 if (a.size() != b.size()) return false; 00121 00122 for (unsigned int i=0; i < a.size(); i++ ) 00123 { 00124 if ( fabs( a[i] - b[i]) > Ptv::tol ) 00125 { 00126 return false; 00127 } 00128 } 00129 00130 return true; 00131 }
Definition at line 160 of file Ptv_tools.cpp.
References mul(), normalize(), sub(), and Ptv::tol.
Referenced by contains3D().
00161 { 00162 00163 Ptv n0; 00164 sub(e0, p, n0); 00165 normalize(n0); 00166 00167 Ptv n1; 00168 sub(e1, p, n1); 00169 normalize(n1); 00170 00171 Ptv n2; 00172 sub(e2, p, n2); 00173 normalize(n2); 00174 00175 double c0 = acos(mul(n0,n1)); 00176 double c1 = acos(mul(n1,n2)); 00177 double c2 = acos(mul(n2,n1)); 00178 00179 if ( fabs(c0 + c1 + c2 - 2*3.1415926535897931) < Ptv::tol) return true; 00180 00181 return false; 00182 }
std::string SyFi::istr | ( | const std::string & | a, | |
int | b, | |||
int | c | |||
) |
std::string SyFi::istr | ( | const std::string & | a, | |
int | b | |||
) |
string SyFi::istr | ( | const string & | a, | |
int | b, | |||
int | c | |||
) |
Definition at line 40 of file utilities.cpp.
References run::s.
00041 { 00042 ostringstream s; 00043 s << a << b << "_" <<c; 00044 return s.str(); 00045 }
string SyFi::istr | ( | const string & | a, | |
int | b | |||
) |
Definition at line 33 of file utilities.cpp.
References run::s.
00034 { 00035 ostringstream s; 00036 s << a << b; 00037 return s.str(); 00038 }
def SyFi::istr | ( | args | ) |
istr(string a, int b) -> string istr(string a, int b, int c) -> string
Definition at line 1262 of file SyFi.py.
Referenced by _wrap_istr__SWIG_0(), _wrap_istr__SWIG_1(), check_CrouzeixRaviart(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::P0::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::Lagrange::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), SyFi::ArnoldFalkWintherWeakSymP::compute_basis_functions(), SyFi::ArnoldFalkWintherWeakSymU::compute_basis_functions(), SyFi::ArnoldFalkWintherWeakSymSigma::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), homogenous_pol(), isymb(), SyFi::Box::line(), SyFi::Tetrahedron::line(), SyFi::Rectangle::line(), SyFi::Triangle::line(), main(), SyFi::Box::rectangle(), SyFi::Simplex::sub_simplex(), and SyFi::Tetrahedron::triangle().
01262 : 01263 """ 01264 istr(string a, int b) -> string 01265 istr(string a, int b, int c) -> string 01266 """ 01267 return _SyFi.istr(*args) 01268 def div(*args):
const GiNaC::symbol& SyFi::isymb | ( | const std::string & | a, | |
int | b, | |||
int | c | |||
) |
const GiNaC::symbol& SyFi::isymb | ( | const std::string & | a, | |
int | b | |||
) |
const symbol& SyFi::isymb | ( | const string & | a, | |
int | b, | |||
int | c | |||
) |
Definition at line 124 of file syfi/symbol_factory.cpp.
References get_symbol(), and istr().
00125 { 00126 return get_symbol(istr(a,b,c)); 00127 }
const symbol& SyFi::isymb | ( | const string & | a, | |
int | b | |||
) |
Definition at line 119 of file syfi/symbol_factory.cpp.
References get_symbol(), and istr().
00120 { 00121 return get_symbol(istr(a,b)); 00122 }
def SyFi::isymb | ( | args | ) |
isymb(string a, int b) -> GiNaC::symbol isymb(string a, int b, int c) -> GiNaC::symbol
Definition at line 1424 of file SyFi.py.
Referenced by _wrap_isymb__SWIG_0(), _wrap_isymb__SWIG_1(), get_symbolic_matrix(), get_symbolic_vector(), and main().
01424 : 01425 """ 01426 isymb(string a, int b) -> GiNaC::symbol 01427 isymb(string a, int b, int c) -> GiNaC::symbol 01428 """ 01429 return _SyFi.isymb(*args) 01430 class Line(Polygon):
def SyFi::lagrange | ( | args | ) |
GiNaC::ex SyFi::lagrange | ( | unsigned int | order, | |
Polygon & | p, | |||
const std::string & | a | |||
) |
Definition at line 514 of file Lagrange.cpp.
References demos::crouzeixraviart::fe, get_symbolic_matrix(), matrix_to_lst2(), SyFi::StandardFE::N(), and SyFi::StandardFE::nbf().
Referenced by _wrap_lagrange().
00515 { 00516 if ( order < 1 ) 00517 { 00518 throw(std::logic_error("Can not create polynomials of order less than 1!")); 00519 } 00520 00521 GiNaC::ex A; 00522 GiNaC::ex ret; 00523 GiNaC::lst basis; 00524 00525 Lagrange fe(p,order); 00526 A = get_symbolic_matrix(1, fe.nbf(), a); 00527 00528 for (unsigned int i=0; i<fe.nbf(); i++) 00529 { 00530 ret += A.op(i)*fe.N(i); 00531 basis.append(fe.N(i)); 00532 } 00533 return GiNaC::lst(ret,matrix_to_lst2(A),basis); 00534 }
def SyFi::lagrangev | ( | args | ) |
lagrangev(unsigned int no_fields, unsigned int order, Polygon p, string a) -> GiNaC::lst
Definition at line 2207 of file SyFi.py.
02207 : 02208 """ 02209 lagrangev(unsigned int no_fields, unsigned int order, Polygon p, 02210 string a) -> GiNaC::lst 02211 """ 02212 return _SyFi.lagrangev(*args) class Dof(_object):
GiNaC::lst SyFi::lagrangev | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
Polygon & | p, | |||
const std::string & | a | |||
) |
Definition at line 536 of file Lagrange.cpp.
References demos::crouzeixraviart::fe, get_symbolic_matrix(), matrix_to_lst2(), SyFi::StandardFE::N(), and SyFi::StandardFE::nbf().
Referenced by _wrap_lagrangev().
00537 { 00538 if ( order < 1 ) 00539 { 00540 throw(std::logic_error("Can not create polynomials of order less than 1!")); 00541 } 00542 00543 GiNaC::ex A; 00544 GiNaC::ex ret; 00545 GiNaC::lst basis; 00546 00547 VectorLagrange fe(p,order); 00548 A = get_symbolic_matrix(1, fe.nbf(), a); 00549 00550 for (unsigned int i=0; i<fe.nbf(); i++) 00551 { 00552 ret += A.op(i)*fe.N(i); 00553 basis.append(fe.N(i)); 00554 } 00555 return GiNaC::lst(ret,matrix_to_lst2(A),basis); 00556 }
def SyFi::legendre | ( | args | ) |
GiNaC::ex SyFi::legendre | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const std::string | a | |||
) |
GiNaC::ex SyFi::legendre | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const string | s | |||
) |
Definition at line 928 of file ginac_tools.cpp.
References demos::simple::f, get_symbolic_matrix(), legendre1D(), matrix_to_lst2(), x, y, and z.
Referenced by _wrap_legendre(), SyFi::Hermite::compute_basis_functions(), legendrev(), and main().
00929 { 00930 using SyFi::x; 00931 using SyFi::y; 00932 using SyFi::z; 00933 00934 // The Legendre polynomials to be used in FiniteElement 00935 GiNaC::ex leg; 00936 GiNaC::ex A; 00937 GiNaC::lst basis; 00938 int dof; 00939 00940 GiNaC::ex b; 00941 00942 // 1D 00943 if(nsd == 1) 00944 { 00945 dof = order+1; 00946 A = get_symbolic_matrix(1,dof,s); 00947 int o=0; 00948 for(GiNaC::const_iterator i = A.begin(); i!=A.end(); ++i) 00949 { 00950 b= legendre1D(x,o); 00951 leg+= (*i)*b; 00952 basis.append(b); 00953 o++; 00954 } 00955 } 00956 // 2D 00957 /* 00958 else if(nsd == 2){ // NB: Only for tensor products on TRIANGLES (not boxes) 00959 / * 2D: structure of coefficients (a_i) 00960 * [ a_0 a_1 P_1(x) a_3 P_2(x) a_6 P_3(x) 00961 * [ a_2 P_1(y) a_4 P_1(x)*P_1(y) a_7 P_2(x)*P_1(y) 00962 * [ a_5 P_2(y) a_8 P_1(x)*P_2(y) 00963 * [ a_9 P_3(y) 00964 * / 00965 dof = (order+1)*(order+2)/2; 00966 A = get_symbolic_matrix(1,dof,s); 00967 size_t i=0; 00968 for (int o = 0; o <= order; o++) { 00969 for (int d = 0; d <= o; d++) { 00970 b = legendre1D(y,d)*legendre1D(x,o-d); 00971 leg += A.op(i)*b; 00972 basis.append(b); 00973 i++; 00974 00975 } 00976 } 00977 } 00978 */ 00979 else if(nsd == 2) // NB: Only for tensor products on rectangles 00980 { 00981 dof = (order+1)*(order+1); 00982 A = get_symbolic_matrix(1,dof,s); 00983 size_t i=0; 00984 for (unsigned int o = 0; o <= order; o++) 00985 { 00986 for (unsigned int d = 0; d <= order; d++) 00987 { 00988 b = legendre1D(y,d)*legendre1D(x,o); 00989 leg += A.op(i)*b; 00990 basis.append(b); 00991 i++; 00992 00993 } 00994 } 00995 } 00996 00997 /* tetrahedron 00998 else if(nsd==3){ 00999 dof = 0; 01000 for (int j=0; j<= order; j++) { 01001 dof += (j+1)*(j+2)/2; 01002 } 01003 A = get_symbolic_matrix(1, dof , s); 01004 01005 size_t i=0; 01006 for (int o = 0; o <= order; o++) { 01007 for (int d = 0; d <= o; d++) { 01008 for (int f = 0; f <= o; f++) { 01009 if ( o-d-f >= 0) { 01010 b = legendre1D(y,f)*legendre1D(z,d)*legendre1D(x,o-d-f); 01011 leg += A.op(i)*b; 01012 basis.append(b); 01013 i++; 01014 } 01015 } 01016 } 01017 } 01018 } 01019 */ 01020 01021 else if(nsd==3) 01022 { 01023 dof = (order+1)*(order+1)*(order+1); 01024 A = get_symbolic_matrix(1, dof , s); 01025 01026 size_t i=0; 01027 for (unsigned int o = 0; o <= order; o++) 01028 { 01029 for (unsigned int d = 0; d <= order; d++) 01030 { 01031 for (unsigned int f = 0; f <= order; f++) 01032 { 01033 b = legendre1D(y,f)*legendre1D(z,d)*legendre1D(x,o); 01034 leg += A.op(i)*b; 01035 basis.append(b); 01036 i++; 01037 } 01038 } 01039 } 01040 } 01041 return GiNaC::lst(leg,matrix_to_lst2(A), basis); 01042 }
GiNaC::ex SyFi::legendre1D | ( | const GiNaC::symbol | x, | |
unsigned int | n | |||
) |
Definition at line 914 of file ginac_tools.cpp.
Referenced by legendre().
00915 { 00916 GiNaC::ex P; 00917 // Rodrigue's formula for Legendre polynomial of 1D 00918 // The interval [-1, 1] 00919 P=1/(pow(2,n)*GiNaC::factorial(n))*GiNaC::diff(GiNaC::pow((x*x-1),n),x,n); 00920 // ----------------- 00921 // The interval [0,1] 00922 // GiNaC::ex xx = 2*x - 1; 00923 // P=1/(pow(2,2*n)*GiNaC::factorial(n))*GiNaC::diff(GiNaC::pow((xx*xx-1),n),x,n); 00924 return P; 00925 }
def SyFi::legendrev | ( | args | ) |
legendrev(unsigned int no_fields, unsigned int order, unsigned int nsd, string a) -> GiNaC::lst
Definition at line 1204 of file SyFi.py.
01204 : 01205 """ 01206 legendrev(unsigned int no_fields, unsigned int order, unsigned int nsd, 01207 string a) -> GiNaC::lst 01208 """ 01209 return _SyFi.legendrev(*args) 01210 def coeff(*args):
GiNaC::lst SyFi::legendrev | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
unsigned int | nsd, | |||
const std::string | a | |||
) |
GiNaC::lst SyFi::legendrev | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
unsigned int | nsd, | |||
const string | a | |||
) |
Definition at line 1045 of file ginac_tools.cpp.
References legendre(), and run::s.
Referenced by _wrap_legendrev().
01046 { 01047 GiNaC::lst ret1; // contains the polynom 01048 GiNaC::lst ret2; // contains the coefficients 01049 GiNaC::lst ret3; // constains the basis functions 01050 GiNaC::lst basis_tmp; 01051 for (unsigned int i=1; i<= no_fields; i++) 01052 { 01053 GiNaC::lst basis; 01054 std::ostringstream s; 01055 s <<a<<""<<i<<"_"; 01056 GiNaC::ex polspace = legendre(order, nsd, s.str()); 01057 ret1.append(polspace.op(0)); 01058 ret2.append(polspace.op(1)); 01059 basis_tmp = GiNaC::ex_to<GiNaC::lst>(polspace.op(2)); 01060 for (GiNaC::lst::const_iterator basis_iterator = basis_tmp.begin(); 01061 basis_iterator != basis_tmp.end(); ++basis_iterator) 01062 { 01063 GiNaC::lst tmp_lst; 01064 for (unsigned int d=1; d<=no_fields; d++) tmp_lst.append(0); 01065 tmp_lst.let_op(i-1) = (*basis_iterator); 01066 ret3.append(tmp_lst); 01067 } 01068 } 01069 return GiNaC::lst(ret1,ret2,ret3); 01070 }
Definition at line 133 of file Ptv_tools.cpp.
References cross(), is_equal(), Ptv::less(), norm(), sub(), and Ptv::tol.
Referenced by contains2D(), and contains3D().
00134 { 00135 00136 if ( is_equal(e0, p) || is_equal(e1, p) ) return true; 00137 00138 // vec0 = e1-e0 00139 Ptv vec0; 00140 sub(e1,e0, vec0); 00141 // vec1 = e1-p 00142 Ptv vec1; 00143 sub(e1, p, vec1); 00144 00145 // check if the vec0 and vec1 are parallel 00146 Ptv c; 00147 cross(vec0, vec1, c); 00148 if (norm(c) > Ptv::tol) 00149 { 00150 return false; 00151 } 00152 00153 // check whether the edge (e0,e1) contains p . 00154 if ( e0.less(p) && e1.less(p) ) return false; 00155 if ( p.less(e0) && p.less(e1) ) return false; 00156 00157 return true; 00158 }
std::string SyFi::lst2string | ( | GiNaC::lst & | l | ) |
Definition at line 47 of file utilities.cpp.
References run::s.
00048 { 00049 00050 ostringstream s; 00051 GiNaC::lst::const_iterator i = l.begin(); 00052 s <<"("<<*i; 00053 ++i; 00054 00055 for (; i != l.end() ; ++i) 00056 { 00057 s<< ","<< *i; 00058 } 00059 s <<");"<<endl; 00060 return s.str(); 00061 }
def SyFi::lst2string | ( | args | ) |
def SyFi::lst_equals | ( | args | ) |
GiNaC::lst SyFi::lst_equals | ( | GiNaC::ex | a, | |
GiNaC::ex | b | |||
) |
Definition at line 351 of file ginac_tools.cpp.
Referenced by _wrap_lst_equals().
00352 { 00353 GiNaC::lst ret; 00354 if ( (GiNaC::is_a<GiNaC::lst>(a)) && (GiNaC::is_a<GiNaC::lst>(b)) /*&& (a.nops() == b.nops())*/ ) { 00355 for (unsigned int i=0; i<= a.nops()-1; i++) 00356 { 00357 ret.append(b.op(i) == a.op(i)); 00358 } 00359 } 00360 else if ( !(GiNaC::is_a<GiNaC::lst>(a)) && !(GiNaC::is_a<GiNaC::lst>(b))) 00361 { 00362 ret.append(b == a); 00363 } 00364 else if ( !(GiNaC::is_a<GiNaC::lst>(a)) && (GiNaC::is_a<GiNaC::lst>(b))) 00365 { 00366 ret.append(b.op(0) == a); 00367 } 00368 else 00369 { 00370 throw(std::invalid_argument("Make sure that the lists a and b are comparable.")); 00371 } 00372 return ret; 00373 }
def SyFi::lst_to_matrix2 | ( | args | ) |
lst_to_matrix2(GiNaC::lst l) -> GiNaC::ex
Definition at line 1150 of file SyFi.py.
01150 : 01151 """lst_to_matrix2(GiNaC::lst l) -> GiNaC::ex""" 01152 return _SyFi.lst_to_matrix2(*args) 01153 def matrix_to_lst2(*args):
GiNaC::ex SyFi::lst_to_matrix2 | ( | const GiNaC::lst & | l | ) |
Definition at line 273 of file ginac_tools.cpp.
Referenced by _wrap_lst_to_matrix2(), bezier_ordinates(), and interior_coordinates().
00274 { 00275 GiNaC::lst::const_iterator itr, itc; 00276 00277 // Find number of rows and columns 00278 size_t rows = l.nops(), cols = 0; 00279 for (itr = l.begin(); itr != l.end(); ++itr) 00280 { 00281 if (!GiNaC::is_a<GiNaC::lst>(*itr)) 00282 // throw (std::invalid_argument("lst_to_matrix: argument must be a list of lists")); 00283 cols = 1; 00284 if (itr->nops() > cols) 00285 cols = itr->nops(); 00286 } 00287 // Allocate and fill matrix 00288 GiNaC::matrix &M = *new GiNaC::matrix(rows, cols); 00289 M.setflag(GiNaC::status_flags::dynallocated); 00290 00291 unsigned i; 00292 for (itr = l.begin(), i = 0; itr != l.end(); ++itr, ++i) 00293 { 00294 unsigned j; 00295 if (cols == 1) 00296 { 00297 M(i, 0) = *itr; 00298 } 00299 else 00300 { 00301 for (itc = GiNaC::ex_to<GiNaC::lst>(*itr).begin(), j = 0; itc != GiNaC::ex_to<GiNaC::lst>(*itr).end(); ++itc, ++j) 00302 M(i, j) = *itc; 00303 } 00304 } 00305 return M; 00306 }
def SyFi::matrix_from_equations | ( | args | ) |
matrix_from_equations(GiNaC::ex eqns, GiNaC::ex symbols, GiNaC::matrix A, GiNaC::matrix b)
Definition at line 1143 of file SyFi.py.
01143 : 01144 """ 01145 matrix_from_equations(GiNaC::ex eqns, GiNaC::ex symbols, GiNaC::matrix A, 01146 GiNaC::matrix b) 01147 """ 01148 return _SyFi.matrix_from_equations(*args) 01149 def lst_to_matrix2(*args):
void SyFi::matrix_from_equations | ( | const GiNaC::ex & | eqns, | |
const GiNaC::ex & | symbols, | |||
GiNaC::matrix & | A, | |||
GiNaC::matrix & | b | |||
) |
Definition at line 248 of file ginac_tools.cpp.
Referenced by _wrap_matrix_from_equations(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::Lagrange::compute_basis_functions(), SyFi::Hermite::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), and SyFi::Robust::compute_basis_functions_old().
00249 { 00250 // build matrix from equation system 00251 GiNaC::matrix sys(eqns.nops(),symbols.nops()); 00252 GiNaC::matrix rhs(eqns.nops(),1); 00253 GiNaC::matrix vars(symbols.nops(),1); 00254 00255 for (size_t r=0; r<eqns.nops(); r++) 00256 { 00257 // lhs-rhs==0 00258 const GiNaC::ex eq = eqns.op(r).op(0)-eqns.op(r).op(1); 00259 GiNaC::ex linpart = eq; 00260 for (size_t c=0; c<symbols.nops(); c++) 00261 { 00262 const GiNaC::ex co = eq.coeff(GiNaC::ex_to<GiNaC::symbol>(symbols.op(c)),1); 00263 linpart -= co*symbols.op(c); 00264 sys(r,c) = co; 00265 } 00266 linpart = linpart.expand(); 00267 rhs(r,0) = -linpart; 00268 } 00269 A = sys; 00270 b = rhs; 00271 }
def SyFi::matrix_to_lst2 | ( | args | ) |
matrix_to_lst2(GiNaC::ex m) -> GiNaC::lst
Definition at line 1154 of file SyFi.py.
01154 : 01155 """matrix_to_lst2(GiNaC::ex m) -> GiNaC::lst""" 01156 return _SyFi.matrix_to_lst2(*args) 01157 def lst_equals(*args):
GiNaC::lst SyFi::matrix_to_lst2 | ( | const GiNaC::ex & | m | ) |
Definition at line 308 of file ginac_tools.cpp.
Referenced by _wrap_matrix_to_lst2(), bernstein(), bezier_ordinates(), homogenous_pol(), interior_coordinates(), lagrange(), lagrangev(), legendre(), pol(), and polb().
00309 { 00310 if (GiNaC::is_a<GiNaC::matrix>(m)) 00311 { 00312 GiNaC::matrix A = GiNaC::ex_to<GiNaC::matrix>(m); 00313 int cols = A.cols(); 00314 int rows = A.rows(); 00315 00316 GiNaC::lst ret; 00317 if ( cols == 1 ) 00318 { 00319 for (unsigned int i=0; i<=A.rows()-1; i++) 00320 { 00321 ret.append(A(i,0)); 00322 } 00323 } 00324 else if ( rows == 1 ) 00325 { 00326 for (unsigned int i=0; i<=A.cols()-1; i++) 00327 { 00328 ret.append(A(0,i)); 00329 } 00330 } 00331 else 00332 { 00333 for (unsigned int i=0; i<=A.rows()-1; i++) 00334 { 00335 GiNaC::lst rl; 00336 for (unsigned int j=0; j<=A.cols()-1; j++) 00337 { 00338 rl.append(A(i,j)); 00339 } 00340 ret.append(rl); 00341 } 00342 } 00343 return ret; 00344 } 00345 else 00346 { 00347 return GiNaC::lst(); 00348 } 00349 }
def SyFi::matvec | ( | args | ) |
matvec(GiNaC::matrix M, GiNaC::lst x) -> GiNaC::lst matvec(GiNaC::ex A, GiNaC::ex x) -> GiNaC::ex
Definition at line 1301 of file SyFi.py.
01301 : 01302 """ 01303 matvec(GiNaC::matrix M, GiNaC::lst x) -> GiNaC::lst 01304 matvec(GiNaC::ex A, GiNaC::ex x) -> GiNaC::ex 01305 """ 01306 return _SyFi.matvec(*args) 01307 def coeffs(*args):
GiNaC::ex SyFi::matvec | ( | GiNaC::ex | A, | |
GiNaC::ex | x | |||
) |
Definition at line 156 of file ginac_tools.cpp.
00157 { 00158 ex sol; 00159 00160 if (GiNaC::is_a<GiNaC::matrix>(A) && GiNaC::is_a<GiNaC::matrix>(x)) 00161 { 00162 GiNaC::matrix AA = GiNaC::ex_to<GiNaC::matrix>(A); 00163 GiNaC::matrix xx = GiNaC::ex_to<GiNaC::matrix>(x); 00164 sol = AA.mul(xx); 00165 } 00166 else 00167 { 00168 throw std::runtime_error("Invalid argument types, need matrices"); 00169 } 00170 return sol; 00171 }
GiNaC::lst SyFi::matvec | ( | GiNaC::matrix & | M, | |
GiNaC::lst & | x | |||
) |
Definition at line 139 of file ginac_tools.cpp.
Referenced by _wrap_matvec__SWIG_0(), and _wrap_matvec__SWIG_1().
00140 { 00141 GiNaC::lst ret; 00142 int nr = M.rows(); 00143 int nc = M.cols(); 00144 for (int i = 0; i < nr; i++) 00145 { 00146 GiNaC::ex tmp; 00147 for (int j = 0; j < nc; j++) 00148 { 00149 tmp = tmp + M(i,j)*(x.op(j)); 00150 } 00151 ret.append(tmp); 00152 } 00153 return ret; 00154 }
Definition at line 26 of file Ptv_tools.cpp.
References Ptv::size().
Referenced by ex2type(), and is_inside_triangle().
00027 { 00028 if ( a.size() != b.size() ) 00029 { 00030 throw(std::logic_error("Exception from mul(const Ptv&, const Ptv&): The dimentions of a and b must be the same.")); 00031 } 00032 00033 double sum = 0; 00034 for (unsigned int i=0; i< a.size(); i++) 00035 { 00036 sum += (a[i])*(b[i]); 00037 } 00038 return sum; 00039 }
double SyFi::norm | ( | const Ptv & | a | ) |
Definition at line 41 of file Ptv_tools.cpp.
References Ptv::size().
Referenced by line_contains(), normal(), normalize(), and tangent().
00042 { 00043 double sum = 0.0; 00044 for (unsigned int i=0; i < a.size(); i++) 00045 { 00046 sum += a[i]*a[i]; 00047 } 00048 00049 sum = sqrt(sum); 00050 return sum; 00051 }
def SyFi::normal | ( | args | ) |
normal(Triangle arg0, unsigned int i) -> GiNaC::lst normal(Tetrahedron arg0, unsigned int i) -> GiNaC::lst
Definition at line 2046 of file SyFi.py.
02046 : 02047 """ 02048 normal(Triangle arg0, unsigned int i) -> GiNaC::lst 02049 normal(Tetrahedron arg0, unsigned int i) -> GiNaC::lst 02050 """ 02051 return _SyFi.normal(*args) 02052 class StandardFE(FE):
GiNaC::lst SyFi::normal | ( | Triangle & | triangle, | |
unsigned int | i | |||
) |
Definition at line 1967 of file Polygon.cpp.
References SyFi::Triangle::line(), norm(), and SyFi::Polygon::vertex().
01968 { 01969 Line line = triangle.line(i); 01970 lst vertex_i = ex_to<lst>(triangle.vertex(i)); 01971 lst vertex_0 = ex_to<lst>(line.vertex(0)); 01972 lst vertex_1 = ex_to<lst>(line.vertex(1)); 01973 01974 /* 01975 lst n1 = lst (- (vertex_1.op(1) - vertex_0.op(1)), vertex_1.op(0) - vertex_0.op(0) ); 01976 lst n2 = lst (vertex_0.op(0) - vertex_i.op(0), vertex_0.op(1) - vertex_i.op(1)); 01977 01978 ex nn = inner(n1, n2); 01979 int sign = 1; 01980 / * 01981 if ( is_a<numeric>(nn)) { 01982 if ( nn > 0 ) { 01983 sign = 1; 01984 } else if ( nn < 0) { 01985 sign = -1; 01986 } else { 01987 sign = 0; 01988 } 01989 } 01990 01991 ex norm = sqrt(pow(n1.op(0),2) + pow(n1.op(1),2)); 01992 n1.let_op(0) = sign*n1.op(0)/norm; 01993 n1.let_op(1) = sign*n1.op(1)/norm; 01994 */ 01995 01996 // normal vector as Marie has defined them 01997 lst n1 = lst ( (vertex_1.op(1) - vertex_0.op(1)), 01998 -(vertex_1.op(0) - vertex_0.op(0)) ); 01999 02000 ex norm = sqrt(pow(n1.op(0),2) + pow(n1.op(1),2)); 02001 n1.let_op(0) = n1.op(0)/norm; 02002 n1.let_op(1) = n1.op(1)/norm; 02003 02004 return n1; 02005 }
GiNaC::lst SyFi::normal | ( | Tetrahedron & | tetrahedron, | |
unsigned int | i | |||
) |
Definition at line 1917 of file Polygon.cpp.
References cross(), norm(), SyFi::Tetrahedron::triangle(), demos::crouzeixraviart::triangle, and SyFi::Polygon::vertex().
Referenced by _wrap_normal__SWIG_0(), _wrap_normal__SWIG_1(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), main(), and variants().
01918 { 01919 // Normal as defined by Maries note 01920 Triangle triangle = tetrahedron.triangle(i); 01921 lst vertex_i = ex_to<lst>(tetrahedron.vertex(i)); 01922 lst vertex_0 = ex_to<lst>(triangle.vertex(0)); 01923 lst vertex_1 = ex_to<lst>(triangle.vertex(1)); 01924 lst vertex_2 = ex_to<lst>(triangle.vertex(2)); 01925 01926 lst n1(vertex_1.op(0) - vertex_0.op(0), 01927 vertex_1.op(1) - vertex_0.op(1), 01928 vertex_1.op(2) - vertex_0.op(2)); 01929 01930 lst n2(vertex_2.op(0) - vertex_0.op(0), 01931 vertex_2.op(1) - vertex_0.op(1), 01932 vertex_2.op(2) - vertex_0.op(2)); 01933 01934 /* 01935 lst n3(vertex_0.op(0) - vertex_i.op(0), 01936 vertex_0.op(1) - vertex_i.op(1), 01937 vertex_0.op(2) - vertex_i.op(2)); 01938 */ 01939 01940 lst n4 = cross(n1,n2); 01941 /* 01942 ex nn = inner(n3, n4); 01943 int sign = 1; 01944 if ( is_a<numeric>(nn)) { 01945 if ( nn > 0 ) { 01946 sign = 1; 01947 } else if ( nn < 0) { 01948 sign = -1; 01949 } else { 01950 sign = 0; 01951 } 01952 } 01953 */ 01954 01955 ex norm = sqrt(pow(n4.op(0),2) 01956 + pow(n4.op(1),2) 01957 + pow(n4.op(2),2)); 01958 01959 n4.let_op(0) = n4.op(0)/norm; 01960 n4.let_op(1) = n4.op(1)/norm; 01961 n4.let_op(2) = n4.op(2)/norm; 01962 01963 return n4; 01964 01965 }
void SyFi::normalize | ( | Ptv & | a | ) |
Definition at line 53 of file Ptv_tools.cpp.
References norm(), and Ptv::size().
Referenced by is_inside_triangle().
00054 { 00055 double invn = 1.0/norm(a); 00056 for (unsigned int i=0; i< a.size(); i++) 00057 { 00058 a[i] *= invn; 00059 } 00060 }
std::ostream & SyFi::operator<< | ( | std::ostream & | os, | |
const OrderedPtvSet_i & | p | |||
) |
Definition at line 184 of file OrderedPtvSet.cpp.
References SyFi::OrderedPtvSet_i::get_i(), SyFi::OrderedPtvSet_i::get_OrderedPtvSet(), and SyFi::OrderedPtvSet_i::size().
00185 { 00186 cout <<p.get_OrderedPtvSet(); 00187 if (p.size() >= 1) 00188 { 00189 os <<",["; 00190 for (unsigned int i=0; i< p.size()-1; i++) 00191 { 00192 os <<p.get_i(i)<<","; 00193 } 00194 os <<p.get_i(p.size()-1)<<"]"; 00195 } 00196 else 00197 { 00198 os <<"OrderedPtvSet_i not created properly"<<std::endl; 00199 } 00200 return os; 00201 }
std::ostream & SyFi::operator<< | ( | std::ostream & | os, | |
const OrderedPtvSet & | p | |||
) |
Definition at line 104 of file OrderedPtvSet.cpp.
References SyFi::OrderedPtvSet::size().
00105 { 00106 if (p.size() >= 1) 00107 { 00108 os <<"["; 00109 for (unsigned int i=0; i< p.size()-1; i++) 00110 { 00111 os <<p[i]<<","; 00112 } 00113 os <<p[p.size()-1]<<"]"; 00114 } 00115 else 00116 { 00117 os <<"OrderedPtvSet not created properly"<<std::endl; 00118 } 00119 return os; 00120 }
def SyFi::pol | ( | args | ) |
GiNaC::ex SyFi::pol | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const std::string | a | |||
) |
GiNaC::ex SyFi::pol | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const string | a | |||
) |
Definition at line 599 of file ginac_tools.cpp.
References demos::simple::f, get_symbolic_matrix(), matrix_to_lst2(), x, y, and z.
Referenced by _wrap_pol(), bernsteinv(), SyFi::Lagrange::compute_basis_functions(), SyFi::Hermite::compute_basis_functions(), main(), and polv().
00600 { 00601 using SyFi::x; 00602 using SyFi::y; 00603 using SyFi::z; 00604 00605 GiNaC::ex ret; // ex to return 00606 int dof; // degrees of freedom 00607 GiNaC::ex A; // ex holding the coefficients a_0 .. a_dof 00608 GiNaC::lst basis; 00609 00610 if (nsd == 1) 00611 { 00612 /* 1D: 00613 * P^n = a_0 + a_1*x + .... + a_n*x^n 00614 * dof : n+1 00615 */ 00616 dof = order+1; 00617 A = get_symbolic_matrix(1,dof, a); 00618 int o=0; 00619 for (GiNaC::const_iterator i = A.begin(); i != A.end(); ++i) 00620 { 00621 ret += (*i)*pow(x,o); 00622 basis.append(pow(x,o)); 00623 o++; 00624 } 00625 } 00626 else if ( nsd == 2) 00627 { 00628 00629 /* 2D: structure of coefficients (a_i) 00630 * [ a_0 a_1 x a_3 x^2 a_6 x^3 00631 * [ a_2 y a_4 xy a_7 x^2y 00632 * [ a_5 y^2 a_8 xy^2 00633 * [ a_9 y^3 00634 */ 00635 dof = (order+1)*(order+2)/2; 00636 A = get_symbolic_matrix(1, dof , a); 00637 00638 size_t i=0; 00639 for (unsigned int o = 0; o <= order; o++) 00640 { 00641 for (unsigned int d = 0; d <= o; d++) 00642 { 00643 ret += A.op(i)*pow(y,d)*pow(x,o-d); 00644 basis.append(pow(y,d)*pow(x,o-d)); 00645 i++; 00646 } 00647 } 00648 } 00649 else if (nsd == 3) 00650 { 00651 00652 /* Similar structure as in 2D, but 00653 * structured as a tetraheder, i.e., 00654 * a_o + a_1 x + a_2 y + a_3 z 00655 * + a_4 x^2 + a_5 xy + 00656 */ 00657 dof = 0; 00658 for (unsigned int j=0; j<= order; j++) 00659 { 00660 dof += (j+1)*(j+2)/2; 00661 } 00662 A = get_symbolic_matrix(1, dof , a); 00663 00664 size_t i=0; 00665 for (unsigned int o = 0; o <= order; o++) 00666 { 00667 for (unsigned int d = 0; d <= o; d++) 00668 { 00669 for (unsigned int f = 0; f <= o; f++) 00670 { 00671 if ( int(o)-int(d)-int(f) >= 0) 00672 { 00673 ret += A.op(i)*pow(y,f)*pow(z,d)*pow(x,o-d-f); 00674 basis.append(pow(y,f)*pow(z,d)*pow(x,o-d-f)); 00675 i++; 00676 } 00677 } 00678 } 00679 } 00680 } 00681 return GiNaC::lst(ret,matrix_to_lst2(A), basis); 00682 }
def SyFi::pol2basisandcoeff | ( | args | ) |
pol2basisandcoeff(GiNaC::ex e) -> GiNaC::exmap pol2basisandcoeff(GiNaC::ex e, GiNaC::ex s) -> GiNaC::exmap
Definition at line 1315 of file SyFi.py.
01315 : 01316 """ 01317 pol2basisandcoeff(GiNaC::ex e) -> GiNaC::exmap 01318 pol2basisandcoeff(GiNaC::ex e, GiNaC::ex s) -> GiNaC::exmap 01319 """ 01320 return _SyFi.pol2basisandcoeff(*args) 01321 def collect_symbols(*args):
GiNaC::exmap SyFi::pol2basisandcoeff | ( | GiNaC::ex | e | ) |
Definition at line 888 of file ginac_tools.cpp.
00889 { 00890 using SyFi::x; 00891 using SyFi::y; 00892 using SyFi::z; 00893 00894 e = expand(e); 00895 GiNaC::ex c; 00896 GiNaC::ex b; 00897 GiNaC::exmap map; 00898 for (int i=e.ldegree(x); i<=e.degree(x); ++i) 00899 { 00900 for (int j=e.ldegree(y); j<=e.degree(y); ++j) 00901 { 00902 for (int k=e.ldegree(z); k<=e.degree(z); ++k) 00903 { 00904 c = e.coeff(x,i).coeff(y, j).coeff(z,k); 00905 b = pow(x,i)*pow(y,j)*pow(z,k); 00906 map[b] = c; 00907 } 00908 } 00909 } 00910 return map; 00911 }
GiNaC::exmap SyFi::pol2basisandcoeff | ( | GiNaC::ex | e, | |
GiNaC::ex | s | |||
) |
Definition at line 864 of file ginac_tools.cpp.
Referenced by _wrap_pol2basisandcoeff__SWIG_0(), _wrap_pol2basisandcoeff__SWIG_1(), SyFi::Robust::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), and SyFi::Robust::compute_basis_functions_old().
00865 { 00866 if (GiNaC::is_a<GiNaC::symbol>(s)) 00867 { 00868 GiNaC::symbol ss = GiNaC::ex_to<GiNaC::symbol>(s); 00869 e = expand(e); 00870 GiNaC::ex c; 00871 GiNaC::ex b; 00872 GiNaC::exmap map; 00873 for (int i=e.ldegree(ss); i<=e.degree(ss); ++i) 00874 { 00875 c = e.coeff(ss,i); 00876 b = pow(ss,i); 00877 map[b] = c; 00878 } 00879 return map; 00880 } 00881 else 00882 { 00883 throw(std::invalid_argument("The second argument must be a symbol.")); 00884 } 00885 }
def SyFi::polb | ( | args | ) |
polb(unsigned int order, unsigned int nsd, string a) -> GiNaC::ex
Definition at line 1185 of file SyFi.py.
01185 : 01186 """polb(unsigned int order, unsigned int nsd, string a) -> GiNaC::ex""" 01187 return _SyFi.polb(*args) 01188 def homogenous_pol(*args):
GiNaC::ex SyFi::polb | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const std::string | a | |||
) |
GiNaC::ex SyFi::polb | ( | unsigned int | order, | |
unsigned int | nsd, | |||
const string | a | |||
) |
Definition at line 724 of file ginac_tools.cpp.
References demos::simple::f, get_symbolic_matrix(), matrix_to_lst2(), x, y, and z.
Referenced by _wrap_polb().
00725 { 00726 using SyFi::x; 00727 using SyFi::y; 00728 using SyFi::z; 00729 00730 GiNaC::ex ret; // ex to return 00731 int dof; // degrees of freedom 00732 GiNaC::ex A; // ex holding the coefficients a_0 .. a_dof 00733 GiNaC::lst basis; 00734 00735 if (nsd == 1) 00736 { 00737 /* 1D: 00738 * P^n = a_0 + a_1*x + .... + a_n*x^n 00739 * dof : n+1 00740 */ 00741 dof = order+1; 00742 A = get_symbolic_matrix(1,dof, a); 00743 int o=0; 00744 for (GiNaC::const_iterator i = A.begin(); i != A.end(); ++i) 00745 { 00746 ret += (*i)*pow(x,o); 00747 basis.append(pow(x,o)); 00748 o++; 00749 } 00750 } 00751 else if ( nsd == 2) 00752 { 00753 00754 /* 2D: structure of coefficients (a_i) 00755 * [ a_0 a_1 x a_3 x^2 a_6 x^3 00756 * [ a_2 y a_4 xy a_7 x^2y 00757 * [ a_5 y^2 a_8 xy^2 00758 * [ a_9 y^3 00759 */ 00760 00761 dof = (order+1)*(order+1); 00762 A = get_symbolic_matrix(1, dof , a); 00763 00764 size_t i=0; 00765 for (unsigned int o = 0; o <= order; o++) 00766 { 00767 for (unsigned int d = 0; d <= order; d++) 00768 { 00769 ret += A.op(i)*pow(y,d)*pow(x,o); 00770 basis.append(pow(y,d)*pow(x,o)); 00771 i++; 00772 } 00773 } 00774 } 00775 else if (nsd == 3) 00776 { 00777 00778 /* Similar structure as in 2D, but 00779 * structured as a tetraheder, i.e., 00780 * a_o + a_1 x + a_2 y + a_3 z 00781 * + a_4 x^2 + a_5 xy + 00782 */ 00783 dof = (order+1)*(order+1)*(order+1); 00784 A = get_symbolic_matrix(1, dof , a); 00785 00786 size_t i=0; 00787 for (unsigned int o = 0; o <= order; o++) 00788 { 00789 for (unsigned int d = 0; d <= order; d++) 00790 { 00791 for (unsigned int f = 0; f <= order; f++) 00792 { 00793 ret += A.op(i)*pow(y,f)*pow(z,d)*pow(x,o); 00794 basis.append(pow(y,f)*pow(z,d)*pow(x,o)); 00795 i++; 00796 } 00797 } 00798 } 00799 } 00800 00801 return GiNaC::lst(ret,matrix_to_lst2(A), basis); 00802 }
def SyFi::polv | ( | args | ) |
polv(unsigned int no_fields, unsigned int order, unsigned int nsd, string a) -> GiNaC::lst
Definition at line 1178 of file SyFi.py.
01178 : 01179 """ 01180 polv(unsigned int no_fields, unsigned int order, unsigned int nsd, 01181 string a) -> GiNaC::lst 01182 """ 01183 return _SyFi.polv(*args) 01184 def polb(*args):
GiNaC::lst SyFi::polv | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
unsigned int | nsd, | |||
const std::string | a | |||
) |
GiNaC::lst SyFi::polv | ( | unsigned int | no_fields, | |
unsigned int | order, | |||
unsigned int | nsd, | |||
const string | a | |||
) |
Definition at line 685 of file ginac_tools.cpp.
Referenced by _wrap_polv().
00686 { 00687 GiNaC::lst ret1; // contains the polynom 00688 GiNaC::lst ret2; // contains the coefficients 00689 GiNaC::lst ret3; // constains the basis functions 00690 GiNaC::lst basis_tmp; 00691 for (unsigned int i=0; i< no_fields; i++) 00692 { 00693 GiNaC::lst basis; 00694 std::ostringstream s; 00695 s <<a<<""<<i<<"_"; 00696 GiNaC::ex polspace = pol(order, nsd, s.str()); 00697 ret1.append(polspace.op(0)); 00698 ret2.append(polspace.op(1)); 00699 basis_tmp = GiNaC::ex_to<GiNaC::lst>(polspace.op(2)); 00700 for (GiNaC::lst::const_iterator basis_iterator = basis_tmp.begin(); 00701 basis_iterator != basis_tmp.end(); ++basis_iterator) 00702 { 00703 GiNaC::lst tmp_lst; 00704 for (unsigned int d=1; d<=no_fields; d++) tmp_lst.append(0); 00705 tmp_lst.let_op(i) = (*basis_iterator); 00706 ret3.append(tmp_lst); 00707 } 00708 } 00709 return GiNaC::lst(ret1,ret2,ret3); 00710 00711 /* Old Code: 00712 GiNaC::lst ret; 00713 for (int i=1; i<= nsd; i++) { 00714 std::ostringstream s; 00715 s <<a<<"^"<<i<<"_"; 00716 GiNaC::ex p = pol(order, nsd, s.str()); 00717 ret.append(p); 00718 } 00719 return ret; 00720 */ 00721 }
void SyFi::print | ( | GiNaC::exmap | map | ) |
Definition at line 125 of file utilities.cpp.
00126 { 00127 GiNaC::ex b; 00128 GiNaC::ex c; 00129 GiNaC::exmap::iterator iter; 00130 cout <<"{" <<b<<":"<<c; 00131 for (iter = map.begin(); iter != map.end(); iter++) 00132 { 00133 b = (*iter).first; c = map[b]; 00134 cout <<", "<<b<<":"<<c; 00135 } 00136 cout <<"}"<<endl; 00137 }
void SyFi::print | ( | ex_int_map | map | ) |
Definition at line 110 of file utilities.cpp.
References SyFi::ex_int_map::begin(), SyFi::ex_int_map::end(), and SyFi::ex_int_map::iterator().
00111 { 00112 GiNaC::ex b; 00113 int c=0; 00114 ex_int_map::iterator iter; 00115 iter = map.begin(); 00116 cout <<"{"; 00117 for (iter = map.begin(); iter != map.end(); iter++) 00118 { 00119 b = (*iter).first; c = map[b]; 00120 cout <<", "<<b<<":"<<c; 00121 } 00122 cout <<"}"<<endl; 00123 }
void SyFi::print | ( | std::map< std::pair< unsigned int, unsigned int >, GiNaC::ex > & | A | ) |
Definition at line 101 of file utilities.cpp.
00102 { 00103 map<std::pair<unsigned int,unsigned int>,GiNaC::ex>::iterator iter; 00104 for (iter = A.begin(); iter != A.end() ; iter++) 00105 { 00106 cout <<"A["<<(*iter).first.first<<","<<(*iter).first.second<<"]="<<(*iter).second<<endl; 00107 } 00108 }
void SyFi::print | ( | GiNaC::exvector & | v | ) |
Definition at line 91 of file utilities.cpp.
00092 { 00093 cout <<"v=["; 00094 for (unsigned int i=0; i< v.size()-1; i++) 00095 { 00096 cout <<v[i]<<"," <<endl; 00097 } 00098 cout <<v[v.size()-1]<< "]"<<endl; 00099 }
void SyFi::print | ( | GiNaC::lst & | l | ) |
Definition at line 75 of file utilities.cpp.
00076 { 00077 // for (GiNaC::lst::const_iterator i = l.begin(); i != l.end(); ++i) 00078 // cout << *i << endl; 00079 // 00080 GiNaC::lst::const_iterator i = l.begin(); 00081 cout <<"GiNaC::lst("<<*i; 00082 ++i; 00083 00084 for (; i != l.end() ; ++i) 00085 { 00086 cout << ","<< *i; 00087 } 00088 cout <<");"<<endl; 00089 }
def SyFi::replace_powers | ( | args | ) |
replace_powers(GiNaC::ex e, std::list<(GiNaC::symbol,std::allocator<(GiNaC::symbol)>)> symbols, std::list<(SyFi::symexpair,std::allocator<(SyFi::symexpair)>)> sel, string tmpsymbolprefix = "p_") -> GiNaC::ex replace_powers(GiNaC::ex e, std::list<(GiNaC::symbol,std::allocator<(GiNaC::symbol)>)> symbols, std::list<(SyFi::symexpair,std::allocator<(SyFi::symexpair)>)> sel) -> GiNaC::ex
Definition at line 1414 of file SyFi.py.
01414 : 01415 """ 01416 replace_powers(GiNaC::ex e, std::list<(GiNaC::symbol,std::allocator<(GiNaC::symbol)>)> symbols, 01417 std::list<(SyFi::symexpair,std::allocator<(SyFi::symexpair)>)> sel, 01418 string tmpsymbolprefix = "p_") -> GiNaC::ex 01419 replace_powers(GiNaC::ex e, std::list<(GiNaC::symbol,std::allocator<(GiNaC::symbol)>)> symbols, 01420 std::list<(SyFi::symexpair,std::allocator<(SyFi::symexpair)>)> sel) -> GiNaC::ex 01421 """ 01422 return _SyFi.replace_powers(*args) 01423 def isymb(*args):
GiNaC::ex SyFi::replace_powers | ( | const GiNaC::ex & | e, | |
const std::list< GiNaC::symbol > & | symbols, | |||
std::list< symexpair > & | sel, | |||
const std::string & | tmpsymbolprefix = "p_" | |||
) |
ex SyFi::replace_powers | ( | const ex & | ein, | |
const list< symbol > & | symbols, | |||
list< symexpair > & | sel, | |||
const string & | tmpsymbolprefix | |||
) |
Definition at line 1380 of file ginac_tools.cpp.
References test::e, get_symbol(), and int2string().
Referenced by _wrap_replace_powers__SWIG_0(), _wrap_replace_powers__SWIG_1(), and variants().
01381 { 01382 ex e = ein; 01383 // build power expressions 01384 list<symbol>::const_iterator it = symbols.begin(); 01385 for(; it != symbols.end(); it++) 01386 { 01387 int deg = e.degree(*it); 01388 if(deg > 0) 01389 { 01390 symbol sym = ex_to<symbol>(*it); 01391 string sname = tmpsymbolprefix + sym.get_name(); 01392 01393 // make list of new symbols 01394 vector<symbol> symbols(deg); 01395 symbols[0] = sym; 01396 for(int i=1; i<deg; i++) 01397 { 01398 symbols[i] = get_symbol( sname + int2string(i+1) ); 01399 sel.push_back(make_pair(symbols[i], symbols[i-1]*sym)); 01400 } 01401 01402 // with highest order first, subs in e 01403 ex prod = sym; 01404 for(int i=deg-1; i>=1; i--) 01405 { 01406 e = e.subs(power(sym,i+1) == symbols[i], subs_options::algebraic); 01407 } 01408 } 01409 } 01410 return e; 01411 }
void SyFi::set_tolerance | ( | double | tolerance | ) |
Definition at line 21 of file Ptv_tools.cpp.
References Ptv::tol.
00022 { 00023 Ptv::tol = tolerance; 00024 }
def SyFi::setDigits | ( | args | ) |
void SyFi::sort_vector | ( | vector< Ptv > & | a | ) |
Definition at line 16 of file Ptv_tools.cpp.
00017 { 00018 sort(a.begin(), a.end(), Ptv_is_less()); 00019 }
Definition at line 76 of file Ptv_tools.cpp.
References Ptv::redim(), and Ptv::size().
Referenced by SyFi::CrouzeixRaviart::compute_basis_functions(), is_inside_triangle(), and line_contains().
00077 { 00078 if ( a.size() != b.size() ) 00079 { 00080 throw(std::logic_error("Exception from add(const Ptv&, const Ptv&, Ptv&): The dimentions of a and b must be the same.")); 00081 } 00082 00083 c.redim(a.size()); 00084 for (unsigned int i=0; i< c.size(); i++) 00085 { 00086 c[i] = a[i] - b[i]; 00087 } 00088 }
def SyFi::swig_import_helper | ( | ) |
Definition at line 10 of file SyFi.py.
00010 : 00011 from os.path import dirname 00012 import imp 00013 fp = None 00014 try: 00015 fp, pathname, description = imp.find_module('_SyFi', [dirname(__file__)]) 00016 except ImportError: 00017 import _SyFi 00018 return _SyFi 00019 if fp is not None: 00020 try: 00021 _mod = imp.load_module('_SyFi', fp, pathname, description) 00022 finally: 00023 fp.close() 00024 return _mod _SyFi = swig_import_helper()
bool SyFi::symbol_exists | ( | const std::string & | name | ) |
bool SyFi::symbol_exists | ( | const string & | name | ) |
Definition at line 104 of file syfi/symbol_factory.cpp.
References symbol_collection.
00105 { 00106 return symbol_collection.find(name) != symbol_collection.end(); 00107 }
def SyFi::symbol_exists | ( | args | ) |
symbol_exists(string name) -> bool
Definition at line 1338 of file SyFi.py.
Referenced by _wrap_symbol_exists(), and main().
01338 : 01339 """symbol_exists(string name) -> bool""" 01340 return _SyFi.symbol_exists(*args) 01341 def get_symbol(*args):
GiNaC::symbol SyFi::t | ( | "(t is not initialized since initSyFi has never been called)" | ) |
def SyFi::tangent | ( | args | ) |
GiNaC::lst SyFi::tangent | ( | Triangle & | triangle, | |
unsigned int | i | |||
) |
Definition at line 2007 of file Polygon.cpp.
References SyFi::Triangle::line(), norm(), and SyFi::Polygon::vertex().
Referenced by _wrap_tangent(), SyFi::Robust::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), and SyFi::Robust::compute_basis_functions_old().
02008 { 02009 /* 02010 Line line = triangle.line(i); 02011 //FIXME: 5 lines to compute the tangent vector, these should 02012 // be put somewhere else. 02013 GiNaC::symbol t("t"); 02014 ex line_repr = line.repr(t); 02015 ex t1 = line_repr.op(0).rhs().coeff(t,1); 02016 ex t2 = line_repr.op(1).rhs().coeff(t,1); 02017 ex norm = sqrt(pow(t1,2) + pow(t2,2)); 02018 lst tangent = lst(t1/norm,t2/norm); 02019 return tangent; 02020 */ 02021 /* 02022 ex t1, t2; 02023 if ( i == 0 ) { 02024 t1 = triangle.vertex(2).op(0) - triangle.vertex(1).op(0); 02025 t2 = triangle.vertex(2).op(1) - triangle.vertex(1).op(1); 02026 } else if ( i == 1 ) { 02027 t1 = triangle.vertex(0).op(0) - triangle.vertex(2).op(0); 02028 t2 = triangle.vertex(0).op(1) - triangle.vertex(2).op(1); 02029 } else if ( i == 2 ) { 02030 t1 = triangle.vertex(1).op(0) - triangle.vertex(0).op(0); 02031 t2 = triangle.vertex(1).op(1) - triangle.vertex(0).op(1); 02032 } else { 02033 throw(std::out_of_range("The side index is out of range!")); 02034 } 02035 */ 02036 Line line = triangle.line(i); 02037 ex t1 = line.vertex(1).op(0) - line.vertex(0).op(0); 02038 ex t2 = line.vertex(1).op(1) - line.vertex(0).op(1); 02039 02040 ex norm = sqrt(pow(t1,2) + pow(t2,2)); 02041 lst tangent = lst(t1/norm,t2/norm); 02042 return tangent; 02043 02044 }
def SyFi::usage | ( | args | ) |
usage(FE fe) usage(FE v_fe, FE p_fe)
Definition at line 2666 of file SyFi.py.
02666 : 02667 """ 02668 usage(FE fe) 02669 usage(FE v_fe, FE p_fe) 02670 """ 02671 return _SyFi.usage(*args) 02672 class ArnoldFalkWintherWeakSymU(StandardFE):
void SyFi::usage | ( | FE & | v_fe, | |
FE & | p_fe | |||
) |
Definition at line 23 of file ElementComputations.cpp.
References SyFi::FE::dof(), grad(), SyFi::FE::N(), and SyFi::FE::nbf().
00024 { 00025 for (unsigned int i=0; i< v_fe.nbf(); i++) 00026 { 00027 cout <<"v_fe.N("<<i<<") = "<<v_fe.N(i)<<endl; 00028 cout <<"grad(v_fe.N("<<i<<")) = "<<grad(v_fe.N(i))<<endl; 00029 cout <<"v_fe.dof("<<i<<") = "<<v_fe.dof(i)<<endl; 00030 } 00031 for (unsigned int i=0; i< p_fe.nbf(); i++) 00032 { 00033 cout <<"p_fe.N("<<i<<")= "<<p_fe.N(i)<<endl; 00034 cout <<"p_fe.dof("<<i<<")= "<<p_fe.dof(i)<<endl; 00035 } 00036 }
void SyFi::usage | ( | FE & | fe | ) |
Definition at line 13 of file ElementComputations.cpp.
References SyFi::FE::dof(), grad(), SyFi::FE::N(), and SyFi::FE::nbf().
Referenced by _wrap_usage__SWIG_0(), and _wrap_usage__SWIG_1().
00014 { 00015 for (unsigned int i=0; i< fe.nbf(); i++) 00016 { 00017 cout <<"fe.N("<<i<<") = "<<fe.N(i)<<endl; 00018 cout <<"grad(fe.N("<<i<<")) = "<<grad(fe.N(i))<<endl; 00019 cout <<"fe.dof("<<i<<") = "<<fe.dof(i)<<endl; 00020 } 00021 }
def SyFi::visitor_subst_pow | ( | args | ) |
void SyFi::visitor_subst_pow | ( | GiNaC::ex | e, | |
GiNaC::exmap & | map, | |||
ex_int_map & | intmap, | |||
std::string | a | |||
) |
void SyFi::visitor_subst_pow | ( | GiNaC::ex | e, | |
GiNaC::exmap & | map, | |||
ex_int_map & | intmap, | |||
string | a | |||
) |
Definition at line 386 of file ginac_tools.cpp.
References run::s.
Referenced by _wrap_visitor_subst_pow().
00387 { 00388 static int i=0; 00389 if (map.find(e) != map.end()) 00390 { 00391 intmap[e] = intmap[e]+1; 00392 return; 00393 } 00394 if (GiNaC::is_exactly_a<GiNaC::power>(e)) 00395 { 00396 std::ostringstream s; 00397 s <<a<<i++; 00398 map[e] = GiNaC::symbol(s.str()); 00399 intmap[e] = 0; 00400 for (unsigned int i=0; i< e.nops(); i++) 00401 { 00402 GiNaC::ex e2 = e.op(i); 00403 // cout <<"power e "<<e2<<endl; 00404 visitor_subst_pow(e2,map,intmap, a); 00405 } 00406 } 00407 else if (GiNaC::is_a<GiNaC::function>(e)) 00408 { 00409 std::ostringstream s; 00410 s <<a<<i++; 00411 map[e] = GiNaC::symbol(s.str()); 00412 intmap[e] = 0; 00413 for (unsigned int i=0; i< e.nops(); i++) 00414 { 00415 GiNaC::ex e2 = e.op(i); 00416 // cout <<"function e "<<e2<<endl; 00417 visitor_subst_pow(e2,map,intmap, a); 00418 } 00419 } 00420 else if (GiNaC::is_a<GiNaC::mul>(e)) 00421 { 00422 if (e.nops() > 4 && e.nops() < 10 ) 00423 { 00424 std::ostringstream s; 00425 s <<a<<i++; 00426 map[e] = GiNaC::symbol(s.str()); 00427 intmap[e] = 0; 00428 } 00429 00430 for (unsigned int i=0; i< e.nops(); i++) 00431 { 00432 GiNaC::ex e2 = e.op(i); 00433 visitor_subst_pow(e2,map,intmap, a); 00434 } 00435 } 00436 else if (GiNaC::is_a<GiNaC::add>(e)) 00437 { 00438 for (unsigned int i=0; i< e.nops(); i++) 00439 { 00440 GiNaC::ex e2 = e.op(i); 00441 visitor_subst_pow(e2,map,intmap,a); 00442 } 00443 } 00444 }
GiNaC::symbol SyFi::x | ( | "(x is not initialized since initSyFi has never been called)" | ) |
GiNaC::symbol SyFi::y | ( | "(y is not initialized since initSyFi has never been called)" | ) |
GiNaC::symbol SyFi::z | ( | "(z is not initialized since initSyFi has never been called)" | ) |
int SyFi::_newclass = 0 |
tuple SyFi::_SyFi = swig_import_helper() |
SyFi::ArnoldFalkWintherWeakSymP_swigregister = _SyFi.ArnoldFalkWintherWeakSymP_swigregister |
SyFi::ArnoldFalkWintherWeakSymSigma_swigregister = _SyFi.ArnoldFalkWintherWeakSymSigma_swigregister |
SyFi::ArnoldFalkWintherWeakSymU_swigregister = _SyFi.ArnoldFalkWintherWeakSymU_swigregister |
SyFi::Box_swigregister = _SyFi.Box_swigregister |
SyFi::Bubble_swigregister = _SyFi.Bubble_swigregister |
SyFi::CrouzeixRaviart_swigregister = _SyFi.CrouzeixRaviart_swigregister |
SyFi::cvar = _SyFi.cvar |
SyFi::DiscontinuousLagrange_swigregister = _SyFi.DiscontinuousLagrange_swigregister |
SyFi::Dof_swigregister = _SyFi.Dof_swigregister |
GiNaC::symbol SyFi::DUMMY |
Referenced by initSyFi(), Swig_var_DUMMY_get(), and Swig_var_DUMMY_set().
SyFi::ex_int_map_swigregister = _SyFi.ex_int_map_swigregister |
SyFi::exlist_swigregister = _SyFi.exlist_swigregister |
SyFi::exmap_swigregister = _SyFi.exmap_swigregister |
SyFi::exset_swigregister = _SyFi.exset_swigregister |
SyFi::ExStats_swigregister = _SyFi.ExStats_swigregister |
SyFi::exvector_swigregister = _SyFi.exvector_swigregister |
SyFi::FE_swigregister = _SyFi.FE_swigregister |
SyFi::GINACLIB_MAJOR_VERSION = _SyFi.GINACLIB_MAJOR_VERSION |
SyFi::GINACLIB_MICRO_VERSION = _SyFi.GINACLIB_MICRO_VERSION |
SyFi::GINACLIB_MINOR_VERSION = _SyFi.GINACLIB_MINOR_VERSION |
SyFi::Hermite_swigregister = _SyFi.Hermite_swigregister |
GiNaC::symbol SyFi::infinity |
Referenced by initSyFi(), Swig_var_infinity_get(), and Swig_var_infinity_set().
SyFi::Lagrange_swigregister = _SyFi.Lagrange_swigregister |
SyFi::Line_swigregister = _SyFi.Line_swigregister |
SyFi::MixedFE_swigregister = _SyFi.MixedFE_swigregister |
SyFi::Nedelec2Hdiv_swigregister = _SyFi.Nedelec2Hdiv_swigregister |
SyFi::Nedelec_swigregister = _SyFi.Nedelec_swigregister |
unsigned int SyFi::nsd = 2 |
Definition at line 19 of file syfi/symbol_factory.cpp.
Referenced by div(), grad(), initSyFi(), main(), SyFi::Simplex::repr(), Swig_var_nsd_get(), Swig_var_nsd_set(), SyFi::TensorLagrange::TensorLagrange(), SyFi::TensorP0::TensorP0(), SyFi::VectorCrouzeixRaviart::VectorCrouzeixRaviart(), SyFi::VectorLagrange::VectorLagrange(), and SyFi::VectorP0::VectorP0().
GiNaC::lst SyFi::p |
Definition at line 25 of file syfi/symbol_factory.cpp.
Referenced by swig::traits_asptr< std::map< K, T > >::asptr(), swig::traits_asptr< std::pair< T, U > >::asptr(), swig::traits_asptr_stdseq< Seq, T >::asptr(), swig::traits_asptr< Type >::asptr(), swig::traits_asval< Type * >::asval(), swig::traits_asval< Type >::asval(), initSyFi(), DofT< D, C >::insert_dof(), SyFi::Dof::insert_dof(), main(), Swig_var_p_get(), Swig_var_p_set(), and SyFi::SymbolCounterVisitor::visit().
SyFi::P0_swigregister = _SyFi.P0_swigregister |
SyFi::Polygon_swigregister = _SyFi.Polygon_swigregister |
SyFi::RaviartThomas_swigregister = _SyFi.RaviartThomas_swigregister |
SyFi::Rectangle_swigregister = _SyFi.Rectangle_swigregister |
SyFi::ReferenceBox_swigregister = _SyFi.ReferenceBox_swigregister |
SyFi::ReferenceLine_swigregister = _SyFi.ReferenceLine_swigregister |
SyFi::ReferenceRectangle_swigregister = _SyFi.ReferenceRectangle_swigregister |
SyFi::ReferenceTetrahedron_swigregister = _SyFi.ReferenceTetrahedron_swigregister |
SyFi::ReferenceTriangle_swigregister = _SyFi.ReferenceTriangle_swigregister |
SyFi::Robust_swigregister = _SyFi.Robust_swigregister |
SyFi::Simplex_swigregister = _SyFi.Simplex_swigregister |
SyFi::SpaceTimeDomain_swigregister = _SyFi.SpaceTimeDomain_swigregister |
SyFi::SpaceTimeElement_swigregister = _SyFi.SpaceTimeElement_swigregister |
SyFi::StandardFE_swigregister = _SyFi.StandardFE_swigregister |
SyFi::SwigPyIterator_swigregister = _SyFi.SwigPyIterator_swigregister |
SyFi::SYFILIB_MAJOR_VERSION = _SyFi.SYFILIB_MAJOR_VERSION |
SyFi::SYFILIB_MICRO_VERSION = _SyFi.SYFILIB_MICRO_VERSION |
SyFi::SYFILIB_MINOR_VERSION = _SyFi.SYFILIB_MINOR_VERSION |
map<string, symbol> SyFi::symbol_collection |
Definition at line 102 of file syfi/symbol_factory.cpp.
Referenced by get_symbol(), and symbol_exists().
SyFi::symexlist_swigregister = _SyFi.symexlist_swigregister |
SyFi::symexpair_swigregister = _SyFi.symexpair_swigregister |
GiNaC::symbol SyFi::t |
Definition at line 33 of file cachetest/test.py.
Referenced by SyFi::SpaceTimeElement::compute_basis_functions(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::Lagrange::compute_basis_functions(), SyFi::CrouzeixRaviart::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), initSyFi(), SyFi::SpaceTimeDomain::integrate(), main(), SyFi::SpaceTimeDomain::repr(), SyFi::Box::repr(), SyFi::Tetrahedron::repr(), SyFi::Rectangle::repr(), Swig_var_t_get(), and Swig_var_t_set().
SyFi::TensorLagrange_swigregister = _SyFi.TensorLagrange_swigregister |
SyFi::TensorP0_swigregister = _SyFi.TensorP0_swigregister |
SyFi::Tetrahedron_swigregister = _SyFi.Tetrahedron_swigregister |
SyFi::Triangle_swigregister = _SyFi.Triangle_swigregister |
SyFi::VectorCrouzeixRaviart_swigregister = _SyFi.VectorCrouzeixRaviart_swigregister |
SyFi::VectorDiscontinuousLagrange_swigregister = _SyFi.VectorDiscontinuousLagrange_swigregister |
SyFi::VectorLagrange_swigregister = _SyFi.VectorLagrange_swigregister |
SyFi::VectorP0_swigregister = _SyFi.VectorP0_swigregister |
const int SyFi::version_major = cvar.version_major |
const int SyFi::version_micro = cvar.version_micro |
const int SyFi::version_minor = cvar.version_minor |
GiNaC::symbol SyFi::x |
Definition at line 8 of file crouzeixraviart.py.
Referenced by barycenter_line(), barycenter_tetrahedron(), barycenter_triangle(), code_gen2D(), coeff(), coeffs(), SyFi::SpaceTimeElement::compute_basis_functions(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::Lagrange::compute_basis_functions(), SyFi::Hermite::compute_basis_functions(), SyFi::CrouzeixRaviart::compute_basis_functions(), SyFi::Bubble::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), div(), ex2equations(), grad(), homogenous_pol(), initSyFi(), SyFi::SpaceTimeDomain::integrate(), legendre(), main(), pickExpression(), pol(), pol2basisandcoeff(), polb(), SyFi::Simplex::repr(), SyFi::Box::repr(), SyFi::Tetrahedron::repr(), SyFi::Rectangle::repr(), SyFi::Triangle::repr(), std_list_Sl_GiNaC_ex_Sg__pop(), std_list_Sl_std_pair_Sl_GiNaC_symbol_Sc_GiNaC_ex_Sg__Sg__pop(), std_vector_Sl_GiNaC_ex_Sg__pop(), SWIG_CanCastAsInteger(), Swig_var_x_get(), Swig_var_x_set(), and variants().
GiNaC::symbol SyFi::y |
Definition at line 4 of file simple.py.
Referenced by code_gen2D(), coeff(), coeffs(), SyFi::Robust::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::Lagrange::compute_basis_functions(), SyFi::Hermite::compute_basis_functions(), SyFi::CrouzeixRaviart::compute_basis_functions(), SyFi::BrezziDouglasMarini::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), div(), ex2equations(), grad(), homogenous_pol(), initSyFi(), legendre(), main(), pickExpression(), pol(), pol2basisandcoeff(), polb(), Swig_var_y_get(), Swig_var_y_set(), and variants().
GiNaC::symbol SyFi::z |
Definition at line 10 of file fem_sympy_core.py.
Referenced by coeff(), coeffs(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Nedelec2Hdiv::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::Lagrange::compute_basis_functions(), SyFi::Hermite::compute_basis_functions(), SyFi::CrouzeixRaviart::compute_basis_functions(), div(), ex2equations(), grad(), homogenous_pol(), initSyFi(), legendre(), main(), pickExpression(), pol(), pol2basisandcoeff(), polb(), Swig_var_z_get(), Swig_var_z_set(), and variants().