Mesh for FMM calculation. More...
#include <mesh.h>
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. | |
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.
| mesh::mesh | ( | conftrans | CT, | |
| int | nrule, | |||
| int | maxpole | |||
| ) |
Initializes the mesh, subdividing the nano-cylinder into finite elements.
| 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().
| double mesh::area | ( | ) | const |
Calculate the area of the figure.
References getNElements().
Referenced by calculateNearIntMat().
| double mesh::area | ( | int | nelem | ) | const |
Calculate the area of the specified element.
| nelem | number of the element to compute the area of. |
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.
| 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. |
References matrixss::product().
Referenced by fmm::energyMS().
| void mesh::calculateNearIntMat | ( | double | g | ) |
Recalculates matrix elements for near partners interaction.
| 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.
| int mesh::divideElement | ( | int | nelem | ) |
Divide the given element in halves.
| nelem | number of the element to divide. |
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.
| nelem | number of the element |
| 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.
Referenced by fmm::fillCharges().
| const cmindices& nanomagn::mesh::getCMI | ( | ) | const [inline] |
returns reference to the cartesian multipole indices object.
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.
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.
| nelem | number of the element | |
| i | the edge to return (0<=i<=3). |
| const edge& nanomagn::mesh::getEdge | ( | int | ne | ) | const [inline] |
Returns i-th edge in this mesh.
| ne | number of the edge |
Referenced by calculateNearIntMat(), and fmm::fillCharges().
| const edges& nanomagn::mesh::getEdges | ( | ) | const [inline] |
Returns edges in this mesh.
| int mesh::getMatSSStorageSize | ( | ) |
Returns the amount of RAM, occupied by the sparse interaction matrices, corresponding to the side charges.
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.
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.
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.
References getNElements().
| int mesh::getMomentsStorageSize | ( | ) |
Returns the amount of RAM, occupied by the multipole moments of all the elements (base groups).
| const matrixss& nanomagn::mesh::getNearInteractionIndices | ( | ) | const [inline] |
Returns the indices of near partners.
Referenced by nanomagn::group::checkGroupCoverage().
| int nanomagn::mesh::getNEdges | ( | ) | const [inline] |
Returns number of edges in this mesh.
| int nanomagn::mesh::getNElements | ( | ) | const [inline] |
Returns elements in this 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.
| bool nanomagn::mesh::isOuterBoundary | ( | int | nelem | ) | const [inline] |
Checks if the specified element touches particle's outer boundary.
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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| nelem | is the number of element. | |
| integrand | is the integrand to integrate. |
Implements elementintegrator.
References isOuterBoundary().
Referenced by calculateNearIntMat().
1.6.3