least_square Class Reference

#include <least_square.h>

List of all members.

Public Member Functions

void L2_nod2sp (FILE *out, long *nsp, double **spcoord, double *nodvalue, double **spvalue, char typ_patch)
void L2_sp2sp (FILE *out, double **spvalue, long nap, const long *parentel, const double **apcoord, double **apvalue)
 least_square (long dim, long ncomp, gtopology *gt, long flag)
void spr_default (FILE *out, double **spvalue, double *nodvalue)
void spr_optional (FILE *out, long *nsp, double **spcoord, double **spvalue, double *nodvalue, long cut_flag)
 ~least_square (void)

Private Member Functions

void adjap_assembling (long nap, const long *parentel, const double **apcoord, long *nadjap, long **adjap)
void apvalue_assembling (const vector &coef_normcoord, const vector *a, long nadjap, const long *adjap, const double **apcoord, double **apvalue)
void compute_patches_nod2sp (char typ_patch)
void compute_patches_sp2sp (long nap, const double **apcoord, const long *nadjap, const long **adjap, double **apvalue)
void compute_patches_spr (long cut_flag)
void insidenod_assembling (void)
void nodvalue_assembling_ae (const vector &coef_normcoord, const vector *a, long nid, ivector &magnitude)
void normal_coordinates_ae (vector &coef_normcoord)
void nsp_spcoord_maxcoord_assembling (char nsma_flag)
void polynom (long ncoef, const double *normcoord, double *p)
void polynom_coefficients_ae (const vector &coef_normcoord, vector *a)
void polynom_coefficients_inv_ae (const vector &coef_normcoord, vector *a, char typ_patch)
void sigma (long ncoef, long nid, const vector &coef_normcoord, const vector *a, ivector &magnitude)
void spvalue_assembling_patch_ae (const vector &coef_normcoord, const vector *a, long id, double **magnitude)

Private Attributes

long * adjel
long dim
 dimension (2 or 3)
long flag
gtopologygt
 actual gtopology
long * insidelem
 array indicating position of elements on domain, dimension (gt->ne ; ???)
long ** insidenod
 array indicating position of nodes on domain, dimension (gt->nn ; ???)
double ** maxcoord
 array of extreme element natural coordinates, dimension (gt->ne ; 4), maxcoord[i]==(max x; min x; max y; min y)
long nadjel
long ne
 number elements on domain
long nn
 number nodes on domain
double * nodvalue
long * nsp
 number of coeficients of patch polynom
long nvals
 number of smoothed ~ aproximated values
double ** spcoord
 array of natural coordinates of sampling points, dimension (gt->ne ; dim*nsp[i]), for 3D, nsp[i]==2 => spcoord[i]==(x1; y1; z1; x2; y2; z2)
double ** spvalue
 array of rough values in sampling points, dimension (gt->ne ; ncomp)

Detailed Description

Definition at line 10 of file least_square.h.


Constructor & Destructor Documentation

least_square ( long  dim,
long  ncomp,
gtopology gt,
long  flag 
)
~least_square ( void   ) 

Definition at line 56 of file least_square.cpp.

References insidenod, maxcoord, ne, nn, nsp, and spcoord.


Member Function Documentation

void adjap_assembling ( long  nap,
const long *  parentel,
const double **  apcoord,
long *  nadjap,
long **  adjap 
) [private]
void apvalue_assembling ( const vector coef_normcoord,
const vector a,
long  nadjap,
const long *  adjap,
const double **  apcoord,
double **  apvalue 
) [private]

Function computes values of `polynoms` in answer points (over all patch ?????).

Parameters:
coef_normcoord - array of coeficients for computing of normed coordinates
a - array of vector of coefficients of `polynoms`
nadjap -
adjap -
@param 

created 4.5.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 1081 of file least_square.cpp.

References vector::a, dim, vector::n, nvals, polynom(), and scprd().

Referenced by compute_patches_sp2sp().

void compute_patches_nod2sp ( char  typ_patch  )  [private]

Function creates element patch around every vertex node (typ_patch=='n') or inside element (typ_patch=='e') and from nodes on patch interpolates values to sampling points.

Parameters:
typ_patch - flag for definition of type of patch

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 766 of file least_square.cpp.

References adjel, gtopology::adjelel, gtopology::adjelnod, destrm(), destrv(), dim, gt, insidelem, insidenod, memset(), nadjel, gtopology::nadjelel, gtopology::nadjelnod, ne, nn, normal_coordinates_ae(), nsp, nvals, polynom_coefficients_inv_ae(), spvalue, and spvalue_assembling_patch_ae().

Referenced by L2_nod2sp().

void compute_patches_sp2sp ( long  nap,
const double **  apcoord,
const long *  nadjap,
const long **  adjap,
double **  apvalue 
) [private]

Function creates element patch around every vertex node and from sampling points inside of patch interpolates values to answer points.

created 4.5.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 828 of file least_square.cpp.

References adjel, gtopology::adjelnod, allocv(), apvalue_assembling(), destrv(), dim, gt, insidenod, nadjel, gtopology::nadjelnod, nn, normal_coordinates_ae(), nvals, and polynom_coefficients_ae().

Referenced by L2_sp2sp().

void compute_patches_spr ( long  cut_flag  )  [private]

Function creates element patch around every vertex node and from sampling points inside of patch interpolates values to nodes.

Parameters:
cut_flag - flag, whether to null values on the "null border" = border of region where known values are zero

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 694 of file least_square.cpp.

References adjel, gtopology::adjelnod, allocv(), gelement::auxinf, destrv(), dim, gtopology::gelements, gt, insidenod, nadjel, gtopology::nadjelnod, nn, nodvalue, nodvalue_assembling_ae(), normal_coordinates_ae(), nsp, nullv(), nvals, polynom_coefficients_ae(), and spvalue.

Referenced by spr_default(), and spr_optional().

void insidenod_assembling ( void   )  [private]

loop 1 : assembles vector of node position in domain 2D: insidenod[i]== 1 -> inside node of domain insidenod[i]==-1 -> node on edge of domain insidenod[i]==-2 -> node at vertex of domain 3D: insidenod[i]== 1 -> inside node of domain insidenod[i]==-1 -> node on boundary area of domain insidenod[i]==-2 -> node on edge of domain insidenod[i]==-3 -> node at vertex of domain

loop 2 : for every "node at vertex of domain"=vn is found "oposite node"=on => => inside[on][inside[on][0]++ - 1] = nv where 'on' is "oposite node" already "inside[on][0]" times.

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 386 of file least_square.cpp.

References gtopology::adjelnod, gelement::auxinf, edge_position(), gtopology::gelements, gtopology::give_nne(), gt, if(), insidelem, insidenod, gtopology::nadjelnod, ne, gelement::nne, gelement::nodes, on, opposite_node(), and surface_position().

Referenced by L2_nod2sp(), L2_sp2sp(), spr_default(), and spr_optional().

void L2_nod2sp ( FILE *  out,
long *  nsp,
double **  spcoord,
double *  nodvalue,
double **  spvalue,
char  typ_patch 
)

ONLY FOR LINEAR TRIANGLE (312) !!!!!!!!!!

This is main function of class least_square. It aproximates values from nodes to 'sampling points'. Answer is array of aproximated values in 'sampling points'. Sampling points are defined by arrays nsp and spcoord.

Parameters:
nsp - number of sampling points on element, dimension is least_square::ne
spcoord - cartesian coorinates of sampling points, dimension is (least_square::ne x nsp[i]*least_squaredim)
nodvalue - known values in nodes, dimension is (least_square::nn * least_square::nvals)
spvalue - answer - smoothed 'values' in sampling points, dimension is (least_square::ne x nsp[i]*least_squarenvals)

created 3.2.2003, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 161 of file least_square.cpp.

References gtopology::adjacelem(), compute_patches_nod2sp(), gt, insidenod_assembling(), gtopology::nadjelnod, nodvalue, nsp, nsp_spcoord_maxcoord_assembling(), spcoord, and spvalue.

void L2_sp2sp ( FILE *  out,
double **  spvalue,
long  nap,
const long *  parentel,
const double **  apcoord,
double **  apvalue 
)

ONLY FOR LINEAR TRIANGLE (312) !!!!!!!!!!

This is main function of class least_square. It aproximates values from known 'sampling points' to another 'sampling points' = 'answer points'. Answer is array of aproximated values in another 'sampling points' = 'answer points'. ???????? Sampling and answer points ARE IDENTICAL to main integration points on elements, ???????? they are defined by arrays nsp, spcoord ... .

Parameters:
nsp - number of sampling points on element, dimension is least_square::ne
spcoord - cartesian coorinates of sampling points, dimension is (least_square::ne x nsp[i]*least_squaredim)
spvalue - answer - smoothed 'values' in sampling points, dimension is (least_square::ne x nsp[i]*least_squarenvals)
nodvalue - known values in nodes, dimension is (least_square::nn * least_square::nvals)

created 4.5.2003, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 204 of file least_square.cpp.

References gtopology::adjacelem(), adjap_assembling(), compute_patches_sp2sp(), gt, insidenod_assembling(), gtopology::nadjelnod, ne, nn, nsp, nsp_spcoord_maxcoord_assembling(), spcoord, and spvalue.

void nodvalue_assembling_ae ( const vector coef_normcoord,
const vector a,
long  nid,
ivector magnitude 
) [private]

Function computes values of `polynoms` in nodes over all patch.

Parameters:
coef_normcoord - array of coeficients for computing of normed coordinates
a - array of vector of coefficients of `polynoms`
id - id of middle node
magnitude - 2D array of sums of magnitudes of values in sampling points

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 1007 of file least_square.cpp.

References adjel, gtopology::gelements, gtopology::give_nne(), gt, insidenod, vector::n, nadjel, nn, gelement::nodes, nodes, and sigma().

Referenced by compute_patches_spr().

void normal_coordinates_ae ( vector coef_normcoord  )  [private]

Function computes coeficients for computing of normed coordinates in patch. This function is called for every patch.

Parameters:
coef_normcoord - answer = array of coeficients for computing of normed coordinates

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 869 of file least_square.cpp.

References adjel, dim, fillv(), maxcoord, and nadjel.

Referenced by compute_patches_nod2sp(), compute_patches_sp2sp(), and compute_patches_spr().

void nsp_spcoord_maxcoord_assembling ( char  nsma_flag  )  [private]

Function fills up arrays: 'nsp' (number of sampling points) by default values, 'spcoord' by natural coordinates of default sampling points, 'maxcoord' by extreme element coordinates.

Parameters:
nsma_flag - determines which array will be actually filled: 'a' = all arrays, 'm' = only array maxcoord

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 249 of file least_square.cpp.

References vector::a, allocv(), gelement::auxinf, bf_quad_3_2d(), bf_quad_4_2d(), destrv(), dim, gtopology::gelements, gtopology::give_node_coord2d(), gtopology::give_node_coord3d(), gt, maxcoord, maxmin_3(), maxmin_4(), ne, gelement::nne, nsp, scprd(), and spcoord.

Referenced by L2_nod2sp(), L2_sp2sp(), spr_default(), and spr_optional().

void polynom ( long  ncoef,
const double *  normcoord,
double *  p 
) [private]

Function computes

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 1128 of file least_square.cpp.

References dim.

Referenced by apvalue_assembling(), polynom_coefficients_ae(), polynom_coefficients_inv_ae(), sigma(), and spvalue_assembling_patch_ae().

void polynom_coefficients_ae ( const vector coef_normcoord,
vector a 
) [private]

Function computes

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 894 of file least_square.cpp.

References addm(), addv(), adjel, cmulv(), dim, fillv(), gause(), vector::n, nadjel, nsp, nvals, polynom(), spcoord, spvalue, and vxv().

Referenced by compute_patches_sp2sp(), and compute_patches_spr().

void polynom_coefficients_inv_ae ( const vector coef_normcoord,
vector a,
char  typ_patch 
) [private]
void sigma ( long  ncoef,
long  nid,
const vector coef_normcoord,
const vector a,
ivector magnitude 
) [private]

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 1101 of file least_square.cpp.

References vector::a, dim, gtopology::gnodes, gt, nn, nodvalue, nvals, polynom(), scprd(), gnode::x, gnode::y, and gnode::z.

Referenced by nodvalue_assembling_ae().

void spr_default ( FILE *  out,
double **  spvalue,
double *  nodvalue 
)

SPR Superconvergent patch recovery This is main function of class least_square. It smooths discontinuous 'values' which are known in 'sampling points'. Answer is array of smoothed values in nodes. Sampling points ARE IDENTICAL to main integration points in first block on elements.

Parameters:
spvalue - 2D array of rough values in sampling points, dimension is (gt->ne) x (nip*tncomp)
nodvalue - answer, 1D array, size is (least_square::nn * least_square::nvals)

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 82 of file least_square.cpp.

References gtopology::adjacelem(), compute_patches_spr(), gt, insidenod_assembling(), gtopology::nadjelnod, ne, nodvalue, nsp, nsp_spcoord_maxcoord_assembling(), spcoord, and spvalue.

void spr_optional ( FILE *  out,
long *  nsp,
double **  spcoord,
double **  spvalue,
double *  nodvalue,
long  cut_flag 
)

SPR Superconvergent patch recovery This is main function of class least_square. It smooths discontinuous 'values' which are known in 'sampling points'. Answer is array of smoothed values in nodes. Sampling points DO NOT HAVE TO BE IDENTICAL to main integration points in first block on elements, they are defined by arrays nsp,spcoord and spvalue.

Parameters:
nsp - number of sampling points on element, dimension is least_square::ne
spcoord - cartesian coorinates of sampling points, dimension is (least_square::ne x nsp[i]*least_squaredim)
spvalue - 'values' in sampling points, dimension is (least_square::ne x nsp[i]*least_squarenvals)
nodvalue - answer, dimension id is (least_square::nn * least_square::nvals)

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 121 of file least_square.cpp.

References gtopology::adjacelem(), compute_patches_spr(), gt, insidenod_assembling(), gtopology::nadjelnod, nodvalue, nsp, nsp_spcoord_maxcoord_assembling(), spcoord, and spvalue.

void spvalue_assembling_patch_ae ( const vector coef_normcoord,
const vector a,
long  id,
double **  magnitude 
) [private]

Function computes values of `polynoms` in sampling points over all patch.

Parameters:
coef_normcoord - array of coeficients for computing of normed coordinates
a - array of vector of coefficients of `polynoms`
id - id of middle element; if patch is round node, id == -1
magnitude - 2D array of sums of magnitudes of values in sampling points

created 3.3.2002, Ladislav Svoboda, termit@cml.fsv.cvut.cz

Definition at line 1040 of file least_square.cpp.

References vector::a, adjel, dim, nadjel, nsp, nvals, polynom(), scprd(), spcoord, and spvalue.

Referenced by compute_patches_nod2sp().


Member Data Documentation

long* adjel [private]
long dim [private]

dimension (2 or 3)

FOLLOWING CHARACTERISTICS MUST BE IDENTICAL FOR EVERY ELEMENT ALL OVER THE DOMAIN dim,ncomp(ncompother),deg(polynom degree of base functions),material

Definition at line 49 of file least_square.h.

Referenced by adjap_assembling(), apvalue_assembling(), compute_patches_nod2sp(), compute_patches_sp2sp(), compute_patches_spr(), least_square(), normal_coordinates_ae(), nsp_spcoord_maxcoord_assembling(), polynom(), polynom_coefficients_ae(), polynom_coefficients_inv_ae(), sigma(), and spvalue_assembling_patch_ae().

long flag [private]

Definition at line 81 of file least_square.h.

Referenced by least_square().

gtopology* gt [private]
long* insidelem [private]

array indicating position of elements on domain, dimension (gt->ne ; ???)

Definition at line 73 of file least_square.h.

Referenced by compute_patches_nod2sp(), insidenod_assembling(), and least_square().

long** insidenod [private]

array indicating position of nodes on domain, dimension (gt->nn ; ???)

Definition at line 71 of file least_square.h.

Referenced by adjap_assembling(), compute_patches_nod2sp(), compute_patches_sp2sp(), compute_patches_spr(), insidenod_assembling(), least_square(), nodvalue_assembling_ae(), and ~least_square().

double** maxcoord [private]

array of extreme element natural coordinates, dimension (gt->ne ; 4), maxcoord[i]==(max x; min x; max y; min y)

Definition at line 69 of file least_square.h.

Referenced by least_square(), normal_coordinates_ae(), nsp_spcoord_maxcoord_assembling(), and ~least_square().

long nadjel [private]
long ne [private]
long nn [private]
double* nodvalue [private]
long* nsp [private]

number of coeficients of patch polynom

number of sampling points on constituent element, dimension == gt->ne

Definition at line 60 of file least_square.h.

Referenced by compute_patches_nod2sp(), compute_patches_spr(), L2_nod2sp(), L2_sp2sp(), least_square(), nsp_spcoord_maxcoord_assembling(), polynom_coefficients_ae(), spr_default(), spr_optional(), spvalue_assembling_patch_ae(), and ~least_square().

long nvals [private]
double** spcoord [private]

array of natural coordinates of sampling points, dimension (gt->ne ; dim*nsp[i]), for 3D, nsp[i]==2 => spcoord[i]==(x1; y1; z1; x2; y2; z2)

Definition at line 62 of file least_square.h.

Referenced by L2_nod2sp(), L2_sp2sp(), least_square(), nsp_spcoord_maxcoord_assembling(), polynom_coefficients_ae(), spr_default(), spr_optional(), spvalue_assembling_patch_ae(), and ~least_square().

double** spvalue [private]

array of rough values in sampling points, dimension (gt->ne ; ncomp)

Definition at line 64 of file least_square.h.

Referenced by compute_patches_nod2sp(), compute_patches_spr(), L2_nod2sp(), L2_sp2sp(), least_square(), polynom_coefficients_ae(), spr_default(), spr_optional(), and spvalue_assembling_patch_ae().


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2