nanomagn::mesh Class Reference

Mesh for FMM calculation. More...

#include <mesh.h>

Inheritance diagram for nanomagn::mesh:
elementintegrator nanomagn::exchange fmm

List of all members.

Public Member Functions

 mesh (conftrans CT, int nrule, int maxpole)
 Initializes the mesh, subdividing the nano-cylinder into finite elements.
void reserve (int nelemreq)
 Performs an advance storage reservation to hold requested number of elements.
void printMesh () const
 Prints the mesh in text form to stdout.
void clearBaseGroupLinks ()
 Clears stored links to base groups.
void clearNearInts ()
 Clears stored near element interactions.
bool isNearIntSymmetric () const
 Checks if the near interaction indices are symmetric.
void reduceNearInts ()
 Reduces near interaction matrices by using their symmetry.
void noteNearInt (int i, int j)
 Notes the near interaction between specified elements. This function memorizes indices of the elements, which are used later to calculate the near interaction integrals.
const matrixss & getNearInteractionIndices () const
 Returns the indices of near partners.
void linkBaseGroup (int nelem, group *grp)
 Links the given base group to the corresponding element.
const group & getBaseGroup (int nelem) const
 Returns the base group, corresponding to the specified element.
double calcEnergyMS (const charges &chrgF, const charges &chrgV, const charges &chrgS)
 Calculates magnetostatic energy, provided smooth field and charges in base groups are known.
const cmindices & getCMI () const
 returns reference to the cartesian multipole indices object.
int getNRule () const
 Returns the order of Gauss-Jacobi integration rule, used in this calculation.
int getNElements () const
 Returns elements in this mesh.
int getNEdges () const
 Returns number of edges in this mesh.
const edges & getEdges () const
 Returns edges in this mesh.
const edge & getEdge (int ne) const
 Returns i-th edge in this mesh.
const edge & getEdge (int nelem, int i) const
 Returns i-th edge of the given element in this mesh.
const std::vector< const group * > getBaseGroups () const
 Returns the vector of pointers to base groups, useful for calculating charges. All base groups are numbered and the charges must be supplied (to the methods, dealing with them) in the same order. The group objects, pointed by the returned vector, contain a number of methods to facilitate coordinate calculations.
const conftrans & getConfTrans () const
 Returns the conformal transform to map the unit disk into the physical space.
bool isOuterBoundary (int nelem) const
 Checks if the specified element touches particle's outer boundary.
virtual double rintegrate (int nelem, const areaintegrand &integrand) const
 Calculate the real part of the contour integral around the given element.
virtual double robintegrate (int nelem, const siderealintegrand &integrand) const
 Calculate real contour integral around the outer boundary, belonging to the given element. For inner elements (not touching the boundary of the particle) this function quickly returns zero.
virtual double robintegrate (int nelem1, int nelem2, const fsintegrand &integrand) const
 Calculate the real part of the double contour-path integral around the outer boundary of the first element and the full contour of the second.
virtual double rintegrate2 (int nelem1, int nelem2, const fsintegrand &integrand) const
 Calculate the real part of the double contour integral around the given elements.
double area (int nelem) const
 Calculate the area of the specified element.
double area () const
 Calculate the area of the figure.
void calculateMoments ()
 Recalculates cached multipole moments for all elements in the current mesh.
void calculateNearIntMat (double g)
 Recalculates matrix elements for near partners interaction.
const moments & getMoments (int nelem) const
 Returns surface multipole moments of the given element, supposing it carries a unit positive charge.
int divideElement (int nelem)
 Divide the given element in halves.
bool checkCoverage () const
 Checks that partners and near partners of each base group and its partners cover the whole particle.
int getMeshStorageSize ()
 Returns the amount of RAM, occupied by the mesh. The mesh consists of elements (base groups) and edges.
int getMomentsStorageSize ()
 Returns the amount of RAM, occupied by the multipole moments of all the elements (base groups).
int getMatVFStorageSize ()
 Returns the amount of RAM, occupied by the sparse interaction matrices, corresponding to the face and volume charges.
int getMatSSStorageSize ()
 Returns the amount of RAM, occupied by the sparse interaction matrices, corresponding to the side charges.
int getMatVSStorageSize ()
 Returns the amount of RAM, occupied by the sparse interaction matrices, corresponding to the side and volume charges interaction.
 ~mesh ()
 Frees the resources, associated with the mesh.

Detailed Description

Mesh for FMM calculation.

The mesh encapsulates all, related to a single FMM calculation in certain geometry. It is able to evaluate its magnetostatic energy.

The general algorithm, for working with this class is to initialize it (subdividing the considered cylinder into a number of finite elements). Set the value of particle's aspect ratio and, finally, get the energy and its derivative.

Author:
Konstantin L. Metlov <metlov@kinetic.ac.donetsk.ua>

Constructor & Destructor Documentation

mesh::mesh ( conftrans  CT,
int  nrule,
int  maxpole 
)

Initializes the mesh, subdividing the nano-cylinder into finite elements.

Parameters:
CT conformal mapping between the unit disk and the physical plane.
nrule order of Gauss-Jacobi integration rule for calculating line integrals along the mesh edges.
maxpole the highest multipole order to keep track of (this can assume only a set of fixed reasonable values, determined by the number of compiled-in translation kernel polynomials).

References conftrans::getSingAngle(), and conftrans::nsing().


Member Function Documentation

double mesh::area (  )  const

Calculate the area of the figure.

Returns:
area of particle's face.

References getNElements().

Referenced by calculateNearIntMat().

double mesh::area ( int  nelem  )  const

Calculate the area of the specified element.

Parameters:
nelem number of the element to compute the area of.
Returns:
area of the specified element.

References rintegrate().

Referenced by nanomagn::group::subdivide().

double mesh::calcEnergyMS ( const charges &  chrgF,
const charges &  chrgV,
const charges &  chrgS 
)

Calculates magnetostatic energy, provided smooth field and charges in base groups are known.

Parameters:
chrgF is the array of face charges on each element of the mesh.
chrgV is the array of volume charges in each element of the mesh.
chrgF is the array of side charges on outer-boundary elements of the mesh.
Returns:
the value of magnetostatic energy.

References matrixss::product().

Referenced by fmm::energyMS().

void mesh::calculateNearIntMat ( double  g  ) 

Recalculates matrix elements for near partners interaction.

Parameters:
g particle's aspect ratio

References area(), getConfTrans(), getEdge(), matrixss::getI(), matrixss::getJ(), matrixss::getNValues(), rintegrate2(), and robintegrate().

Referenced by fmm::setG().

bool mesh::checkCoverage (  )  const

Checks that partners and near partners of each base group and its partners cover the whole particle.

Returns:
true if the above assertion holds.
int mesh::divideElement ( int  nelem  ) 

Divide the given element in halves.

Parameters:
nelem number of the element to divide.
Returns:
the number of newly added element.

References getNElements().

Referenced by nanomagn::group::subdivide().

const group& nanomagn::mesh::getBaseGroup ( int  nelem  )  const [inline]

Returns the base group, corresponding to the specified element.

Parameters:
nelem number of the element
Returns:
the respective base group.
const std::vector<const group*> nanomagn::mesh::getBaseGroups (  )  const [inline]

Returns the vector of pointers to base groups, useful for calculating charges. All base groups are numbered and the charges must be supplied (to the methods, dealing with them) in the same order. The group objects, pointed by the returned vector, contain a number of methods to facilitate coordinate calculations.

Returns:
array of groups.

Referenced by fmm::fillCharges().

const cmindices& nanomagn::mesh::getCMI (  )  const [inline]

returns reference to the cartesian multipole indices object.

Returns:
const reference to cartesian multipole indices

Referenced by nanomagn::group::precalcTaylor(), nanomagn::group::updateMoments(), and nanomagn::group::updateSmoothField().

const conftrans& nanomagn::mesh::getConfTrans (  )  const [inline]

Returns the conformal transform to map the unit disk into the physical space.

Returns:
Conformal transform object.

Referenced by calculateNearIntMat(), fmm::chargesFace(), fmm::chargesSide(), fmm::chargesVolume(), fmm::fillCharges(), and nanomagn::group::group().

const edge& nanomagn::mesh::getEdge ( int  nelem,
int  i 
) const [inline]

Returns i-th edge of the given element in this mesh.

Parameters:
nelem number of the element
i the edge to return (0<=i<=3).
Returns:
The specified edge.
const edge& nanomagn::mesh::getEdge ( int  ne  )  const [inline]

Returns i-th edge in this mesh.

Parameters:
ne number of the edge
Returns:
The specified edge.

Referenced by calculateNearIntMat(), and fmm::fillCharges().

const edges& nanomagn::mesh::getEdges (  )  const [inline]

Returns edges in this mesh.

Returns:
Edges in the mesh.
int mesh::getMatSSStorageSize (  ) 

Returns the amount of RAM, occupied by the sparse interaction matrices, corresponding to the side charges.

Returns:
The amount of RAM in bytes.

References matrixss::getMatIndicesStorageSize(), and matrixss::getNValues().

int mesh::getMatVFStorageSize (  ) 

Returns the amount of RAM, occupied by the sparse interaction matrices, corresponding to the face and volume charges.

Returns:
The amount of RAM in bytes.

References matrixss::getMatIndicesStorageSize(), and matrixss::getNValues().

int mesh::getMatVSStorageSize (  ) 

Returns the amount of RAM, occupied by the sparse interaction matrices, corresponding to the side and volume charges interaction.

Returns:
The amount of RAM in bytes.

References matrixss::getMatIndicesStorageSize(), and matrixss::getNValues().

int mesh::getMeshStorageSize (  ) 

Returns the amount of RAM, occupied by the mesh. The mesh consists of elements (base groups) and edges.

Returns:
The amount of RAM in bytes.

References getNElements().

int mesh::getMomentsStorageSize (  ) 

Returns the amount of RAM, occupied by the multipole moments of all the elements (base groups).

Returns:
The amount of RAM in bytes.
const matrixss& nanomagn::mesh::getNearInteractionIndices (  )  const [inline]

Returns the indices of near partners.

Returns:
Reference to the matrixss object, representing the indices.

Referenced by nanomagn::group::checkGroupCoverage().

int nanomagn::mesh::getNEdges (  )  const [inline]

Returns number of edges in this mesh.

Returns:
Number of edges in the mesh.
int nanomagn::mesh::getNElements (  )  const [inline]

Returns elements in this mesh.

Returns:
Elements in the mesh. Returns number of elements in this mesh.
Number of elements in the mesh.

Referenced by area(), calculateMoments(), nanomagn::group::checkGroupCoverage(), clearBaseGroupLinks(), divideElement(), fmm::energyMS(), getMeshStorageSize(), getMoments(), nanomagn::group::group(), and printMesh().

int nanomagn::mesh::getNRule (  )  const [inline]

Returns the order of Gauss-Jacobi integration rule, used in this calculation.

Returns:
Order of Gauss-Jacobi integration rule.
bool nanomagn::mesh::isOuterBoundary ( int  nelem  )  const [inline]

Checks if the specified element touches particle's outer boundary.

Returns:
true if the element is at the boundary of the particle.

Referenced by fmm::fillCharges(), noteNearInt(), robintegrate(), and nanomagn::group::updateMoments().

void nanomagn::mesh::linkBaseGroup ( int  nelem,
group *  grp 
) [inline]

Links the given base group to the corresponding element.

Parameters:
nelem is the number of the element.
grp is the pointer to the group being linked.

Referenced by nanomagn::group::linkBaseGroups().

void nanomagn::mesh::noteNearInt ( int  i,
int  j 
) [inline]

Notes the near interaction between specified elements. This function memorizes indices of the elements, which are used later to calculate the near interaction integrals.

In general, if the element i is near partner of the element j, the element j must be near partner of the element j. Both partnerships must be registered with this function. The symmetry of interactions is checked later, before the integrals are evaluated.

Parameters:
i the first element
j the second element

References isOuterBoundary(), and matrixss::noteIdx().

Referenced by nanomagn::group::noteNearPartner().

void mesh::reserve ( int  nelemreq  ) 

Performs an advance storage reservation to hold requested number of elements.

Parameters:
nelemreq number of elements requested.
double mesh::rintegrate ( int  nelem,
const areaintegrand &  integrand 
) const [virtual]

Calculate the real part of the contour integral around the given element.

Parameters:
nelem is the number of element.
integrand is the integrand to integrate.

Implements elementintegrator.

Referenced by area().

double mesh::rintegrate2 ( int  nelem1,
int  nelem2,
const fsintegrand &  integrand 
) const [virtual]

Calculate the real part of the double contour integral around the given elements.

Parameters:
nelem1 is the number of the first element.
nelem2 is the number of the second element.
integrand is the integrand to integrate.

Referenced by calculateNearIntMat().

double mesh::robintegrate ( int  nelem1,
int  nelem2,
const fsintegrand &  integrand 
) const [virtual]

Calculate the real part of the double contour-path integral around the outer boundary of the first element and the full contour of the second.

Parameters:
nelem1 is the number of the first element.
nelem2 is the number of the second element.
integrand is the integrand to integrate.

References isOuterBoundary().

double mesh::robintegrate ( int  nelem,
const siderealintegrand &  integrand 
) const [virtual]

Calculate real contour integral around the outer boundary, belonging to the given element. For inner elements (not touching the boundary of the particle) this function quickly returns zero.

Parameters:
nelem is the number of element.
integrand is the integrand to integrate.

Implements elementintegrator.

References isOuterBoundary().

Referenced by calculateNearIntMat().


The documentation for this class was generated from the following files:
Generated on Mon Oct 8 18:26:45 2012 for nanomagnFMM by  doxygen 1.6.3