Square Class Reference

#include <SimpleMesh.h>

List of all members.

Public Member Functions

 Square (GiNaC::ex x0, GiNaC::ex xn, int nx, int ny)
 ~Square ()
int no_of_triangles ()
int no_of_boundary_nodes ()
Triangle triangle (int i)
GiNaC::ex boundary_node (int i)

Private Attributes

GiNaC::ex x0
GiNaC::ex xn
int nx
int ny


Detailed Description

Definition at line 7 of file SimpleMesh.h.


Constructor & Destructor Documentation

Square::Square GiNaC::ex  x0,
GiNaC::ex  xn,
int  nx,
int  ny
 

Definition at line 3 of file SimpleMesh.cpp.

References nx, ny, x0, and xn.

00003                                                           {
00004   x0 = x0_; 
00005   xn = xn_; 
00006   nx = nx_; 
00007   ny = ny_;
00008 }

Square::~Square  )  [inline]
 

Definition at line 12 of file SimpleMesh.h.

00012 {}


Member Function Documentation

GiNaC::ex Square::boundary_node int  i  ) 
 

Definition at line 18 of file SimpleMesh.cpp.

References DUMMY, no_of_boundary_nodes(), nx, ny, x0, and xn.

00018                                      {
00019   if (i>= 0 && i <= nx-1 ) {  
00020     GiNaC::ex dx = (xn.op(0) - x0.op(0))/(nx-1); 
00021     return GiNaC::lst(x0.op(0) + (i-1)*dx, x0.op(1));  
00022   } else if (i >= nx && i <= nx+ny-2) { 
00023     GiNaC::ex dy = (xn.op(1) - x0.op(1))/(ny-1); 
00024     return GiNaC::lst(xn.op(0), x0.op(1) + (i-nx)*dy);  
00025   } else if (i >= nx+ny-1 && i <= 2*nx+ny-3) { 
00026     GiNaC::ex dx = (xn.op(0) - x0.op(0))/(nx-1); 
00027     return GiNaC::lst(xn.op(0) - dx*(i-nx-ny+1) , xn.op(1));    
00028   } else if (i >= 2*nx+ny-2&& i <= no_of_boundary_nodes() ) {
00029     GiNaC::ex dy = (xn.op(1) - x0.op(1))/(ny-1); 
00030     return GiNaC::lst(x0.op(0), xn.op(1) - (i-2*nx-ny+2)*dy);  
00031   }
00032   return DUMMY; 
00033 }

int Square::no_of_boundary_nodes  ) 
 

Definition at line 14 of file SimpleMesh.cpp.

References nx, and ny.

Referenced by boundary_node().

00014                                   {
00015   return 2*nx + 2*(ny-2);  
00016 }

int Square::no_of_triangles  ) 
 

Definition at line 10 of file SimpleMesh.cpp.

References nx, and ny.

00010                             {
00011   return 2*(nx-1)*(ny-1);  
00012 }

Triangle Square::triangle int  i  ) 
 

Definition at line 35 of file SimpleMesh.cpp.

References DUMMY, nx, ny, x0, and xn.

00035                                {
00036   GiNaC::ex dx = (xn.op(0) - x0.op(0))/(nx-1); 
00037   GiNaC::ex dy = (xn.op(1) - x0.op(1))/(ny-1); 
00038 
00039   int box = (i-1)/2+1; 
00040 
00041   GiNaC::ex p0,p1,p2,p3; 
00042   p0 = GiNaC::lst(0,0,0); 
00043   p0 = GiNaC::lst(x0.op(0) + ((box-1)%(nx-1))*dx, x0.op(1)     + ((box-1)/(ny-1))*dy);     
00044   p1 = GiNaC::lst(x0.op(0) + (((box-1)%(nx-1))+1)*dx, x0.op(1) + ((box-1)/(ny-1))*dy);     
00045   p2 = GiNaC::lst(x0.op(0) + ((box-1)%(nx-1))*dx, x0.op(1)     + (((box-1)/(ny-1))+1)*dy);     
00046   p3 = GiNaC::lst(x0.op(0) + (((box-1)%(nx-1))+1)*dx, x0.op(1) + (((box-1)/(ny-1))+1)*dy);     
00047 
00048   if (i%2 == 1) {
00049     return Triangle(p0,p1,p2); 
00050   } else if ( i%2 == 0) {
00051     return Triangle(p3,p1,p2); 
00052   }
00053   return Triangle(DUMMY,DUMMY,DUMMY); 
00054 }


Member Data Documentation

int Square::nx [private]
 

Definition at line 9 of file SimpleMesh.h.

Referenced by boundary_node(), no_of_boundary_nodes(), no_of_triangles(), Square(), and triangle().

int Square::ny [private]
 

Definition at line 9 of file SimpleMesh.h.

Referenced by boundary_node(), no_of_boundary_nodes(), no_of_triangles(), Square(), and triangle().

GiNaC::ex Square::x0 [private]
 

Definition at line 8 of file SimpleMesh.h.

Referenced by boundary_node(), Square(), and triangle().

GiNaC::ex Square::xn [private]
 

Definition at line 8 of file SimpleMesh.h.

Referenced by boundary_node(), Square(), and triangle().


The documentation for this class was generated from the following files:
Generated on Mon Jan 9 18:08:09 2006 for SyFi by  doxygen 1.4.4