From 8fb6c34bb0d6b9f1b026ef42cd4c73a2c738c2b4 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt <Ansgar.Burchardt@tu-dresden.de> Date: Thu, 31 Aug 2017 18:58:29 +0200 Subject: [PATCH] remove functions to create `BLOCKVECTOR` for regular rectangular grid --- gm/algebra.cc | 707 -------------------------------------------------- gm/gm.doc | 6 +- gm/gm.h | 5 - 3 files changed, 1 insertion(+), 717 deletions(-) diff --git a/gm/algebra.cc b/gm/algebra.cc index 91b300a38..5416adeb9 100644 --- a/gm/algebra.cc +++ b/gm/algebra.cc @@ -269,15 +269,6 @@ static DOUBLE InvMeshSize; REP_ERR_FILE -/****************************************************************************/ -/* */ -/* forward declarations of functions used before they are defined */ -/* */ -/****************************************************************************/ - -static INT CreateBVPlane( BLOCKVECTOR **bv_plane, const BV_DESC *bvd_plane, const BV_DESC_FORMAT *bvdf, VECTOR **v, INT stripes, INT vectors_per_stripe, GRID *grid ); -static INT BlockHalfening( GRID *grid, BLOCKVECTOR *bv, INT left, INT bottom, INT width, INT height, INT side, INT orientation, INT leaf_size ); - /****************************************************************************/ /** \brief Initialize a blockvector description format * @@ -4787,706 +4778,8 @@ void NS_DIM_PREFIX SetLevelnumberBV( BLOCKVECTOR *bv, INT level ) SetLevelnumberBV( bv, level + 1 ); } - -/****************************************************************************/ -/** \brief Creates a stripewise decomposition of a 2D rectangular domain with a regular mesh - * - * @param bv_plane - handle for the blockvector covering the plane - * @param bvd_plane - blockvector description for the block 'bv_plane' - * @param bvdf - blockvector description format for 'bvd_plane' - * @param v - input: handle to the first vector; output: handle to the 'last' vector in this plane - * @param stripes - number of stripes to be constructed - * @param vectors_per_stripe - number of vectors a stripe should contain - * @param grid - the grid containing the vectors to be structured - * - From the list of vectors the blockvector-list is generated in - the following way: - First a blockvector 'bv_plane' corresponding to 'bvd_plane' is constructed - which will cover all the blockvectors for the single stripes and - thus all the vectors of the plane. Beginning - at the start of the vector-list ('v'), blocks are constructed containing - 'vectors_per_stripe' consecutive vectors. The start of the new - blockvector-list is anchored in the blockvector 'bv_plane'. - This blockvectors are - numbered beginning from 0 along the construction. If the vector-list - is not long enough, the function will not be troubled but construct - as far as possible the structure and GM_INCONSISTENCY is returned. - - REQUIREMENTS: - The macro '__BLOCK_VECTOR_DESC__' must be defined in 'gm.h' to enable - blockvector descriptions. - - REMARK: - This is only an auxiliary function. In the returned 'bv_plane' the - components BVSUCC, BVPRED, BVNUMBER are not yet set. - - APPLICATION: - If the vector-list is ordered lexicographic, each line resp. column - containing 'vectors_per_stripe' vectors, then this function constructs - the blockvector structure belonging to a - `linewise domain decomposition`. - - If 'vectors_per_stripe' is a natural multiple of the actual linewidth - (resp. columnlength), this function constructs the blockvector - structure belonging to a `stripewise domain decomposition`, each stripe - consisting of 'vectors_per_stripe'/linewidth lines (resp. columns). - - * @return <ul> - * <li>GM_OK if ok </li> - * <li>GM_OUT_OF_MEM if there was not enough memory to allocate all blockvectors </li> - * <li>GM_INCONSISTENCY if the vector-list was too short </li> - </ul> - * \sa - BLOCKVECTOR, CreateBVStripe2D, CreateBVStripe3D, CreateBVDomainHalfening - - */ -/****************************************************************************/ - -static INT CreateBVPlane( BLOCKVECTOR **bv_plane, const BV_DESC *bvd_plane, const BV_DESC_FORMAT *bvdf, VECTOR **v, INT stripes, INT vectors_per_stripe, GRID *grid ) -{ - BLOCKVECTOR *bv; - BLOCKVECTOR *prev; - INT i, j; - VECTOR *pred_v; - - (void)CreateBlockvector( grid, bv_plane ); - if ( *bv_plane == NULL ) - return GM_OUT_OF_MEM; - - SETBVDOWNTYPE( *bv_plane, BVDOWNTYPEBV ); /* further blocks follow */ - SETBVTVTYPE( *bv_plane, BV1DTV ); - SETBVORIENTATION( *bv_plane, BVNOORIENTATION ); - BVFIRSTVECTOR( *bv_plane ) = *v; - - /* construct for each stripe a blockvector */ - for ( i = 0; (i < stripes) && (*v != NULL); i++ ) - { - (void)CreateBlockvector( grid, &bv ); - - if ( i == 0 ) - { - BVDOWNBV( *bv_plane ) = bv; /* anchor stripe-blocks in the block of the plane */ - if ( bv == NULL ) - return GM_OUT_OF_MEM; - BVPRED( bv ) = NULL; - } - else - { - BVSUCC( prev ) = bv; /* continue blockvector list */ - if ( bv == NULL ) - return GM_OUT_OF_MEM; - BVPRED( bv ) = prev; - } - - prev = bv; /* prepare for the next loop */ - - SETBVDOWNTYPE( bv, BVDOWNTYPEVECTOR ); /* block is at last block level */ - SETBVTVTYPE( bv, BV1DTV ); - SETBVORIENTATION( bv, BVHORIZONTAL ); - BVNUMBER( bv ) = i; - - /* let the blockvector point to the vector */ - BVDOWNVECTOR( bv ) = *v; - BVFIRSTVECTOR( bv ) = *v; - - /* find successor of the last vector of this blockvector and store it; - update the blockvector description for all vectors of this - blockvector - */ - for ( j = vectors_per_stripe; (j > 0) && (*v != NULL); j-- ) - { - VBVD( *v ) = *bvd_plane; - BVD_PUSH_ENTRY( &VBVD( *v ), i, bvdf ); - pred_v = *v; - *v = SUCCVC( *v ); - } - BVLASTVECTOR( bv ) = pred_v; - BVNUMBEROFVECTORS( bv ) = vectors_per_stripe - j; - } - BVSUCC( bv ) = NULL; /* end of the blockvector list */ - - *v = pred_v; - BVLASTVECTOR( *bv_plane ) = *v; - BVDOWNBVLAST( *bv_plane ) = bv; - BVNUMBEROFVECTORS( *bv_plane ) = stripes * vectors_per_stripe - j; - - /* the for loop exited premature because of v == NULL */ - if ( (i < stripes) || (j != 0) ) - return GM_INCONSISTENCY; - - return GM_OK; -} #endif /* __BLOCK_VECTOR_DESC__ */ - -/****************************************************************************/ -/** \brief Creates a stripewise domain decomposition of a 2D rectangular domain with a regular mesh - * - * @param grid - the grid containing the vectors to be structured - * @param vectors - number of vectors, i.e. gridpoints, in the inner - * @param vectors_per_stripe - number of vectors a stripe should contain - * - From the list of vectors the blockvector-list is generated in - the following way: - The first blockvector level consists of 2 blockvectors: the first - covering all inner vectors (number 0), the second all boundary vectors - (number 1). Beginning - at the start of the vector-list, blocks are constructed containing - 'vectors_per_stripe' consecutive vectors. The start of the new - blockvector-list is anchored in the blockvector for the inner vectors. - This blockvectors are - numbered beginning from 0 along the construction. If the vector-list - is shorter than 'vectors', the function will not be troubled - and GM_INCONSISTENCY is returned. If the vector-list - is longer than 'vectors', these vectors are covered in a separate - blockvector with number 1 (this overlapping vectors might be for - example dirichlet boundary vectors). - - For the blockvectors in the tree with root 'all inner' the level-field is - set beginning with 0. - - REQUIREMENTS: - The macro '__BLOCK_VECTOR_DESC__' must be defined in 'gm.h' to enable - blockvector descriptions. - - APPLICATION: - If the vector-list is ordered lexicographic, each line resp. column - containing 'vectors_per_stripe' vectors, then this function constructs - the blockvector structure belonging to a - `linewise domain decomposition`. - - If 'vectors_per_stripe' is a natural multiple of the actual linewidth - (resp. columnlength), this function constructs the blockvector - structure belonging to a `stripewise domain decomposition`, each stripe - consisting of 'vectors_per_stripe'/linewidth lines (resp. columns). - - * @return <ul> - - * <li>GM_OK if ok </li> - * <li>GM_OUT_OF_MEM if there was not enough memory to allocate all blockvectors </li> - * <li>GM_INCONSISTENCY if the vector-list was too short </li> - </ul> - * \sa - BLOCKVECTOR, CreateBVStripe3D, CreateBVDomainHalfening - - */ -/****************************************************************************/ - -INT NS_DIM_PREFIX CreateBVStripe2D( GRID *grid, INT vectors, INT vectors_per_stripe ) -{ -#ifdef __BLOCK_VECTOR_DESC__ - BLOCKVECTOR *bv_inner, *bv_boundary; - VECTOR *v; - INT nr_blocks, ret; - BV_DESC bvd; - - if ( GFIRSTBV( grid ) != NULL ) - FreeAllBV( grid ); - - /* number of blockvectors to be constructed */ - nr_blocks = ( vectors + vectors_per_stripe - 1) / vectors_per_stripe; - - BVD_INIT( &bvd ); - BVD_PUSH_ENTRY( &bvd, 0, &two_level_bvdf ); - v = FIRSTVECTOR( grid ); - ret = CreateBVPlane( &bv_inner, &bvd, &two_level_bvdf, &v, nr_blocks, vectors_per_stripe, grid ); - if ( ret != GM_OK ) - { - FreeBVList( grid, bv_inner ); - return ret; - } - v = SUCCVC( v ); - - (void)CreateBlockvector( grid, &bv_boundary ); - if ( bv_boundary == NULL ) - { - FreeBVList( grid, bv_inner ); - return GM_OUT_OF_MEM; - } - - GFIRSTBV( grid ) = bv_inner; /* anchor blockvector list in the grid */ - GLASTBV( grid ) = bv_boundary; - - BVPRED( bv_inner ) = NULL; - BVSUCC( bv_inner ) = bv_boundary; - BVNUMBER( bv_inner ) = 0; - - BVPRED( bv_boundary ) = bv_inner; - BVSUCC( bv_boundary ) = NULL; - BVNUMBER( bv_boundary ) = 1; - SETBVDOWNTYPE( bv_boundary, BVDOWNTYPEVECTOR ); /* block is at last block level */ - SETBVTVTYPE( bv_boundary, BV1DTV ); - SETBVORIENTATION( bv_boundary, BVNOORIENTATION ); - BVNUMBEROFVECTORS( bv_boundary ) = NVEC( grid ) - BVNUMBEROFVECTORS( bv_inner ); - BVFIRSTVECTOR( bv_boundary ) = v; - BVLASTVECTOR( bv_boundary ) = LASTVECTOR( grid ); - - /* complete the boundary vector list */ - BVD_INC_LAST_ENTRY( &bvd, 1, &two_level_bvdf ); - for ( ; v != NULL; v = SUCCVC( v ) ) - VBVD( v ) = bvd; - - SetLevelnumberBV( bv_inner, 0 ); - return GM_OK; -#else - return(1); -#endif /* __BLOCK_VECTOR_DESC__ */ -} - - -/****************************************************************************/ -/** \brief Creates a plane- and stripewise domain decomposition of a 3D rectangular domain with a regular mesh - - * @param grid - the grid containing the vectors to be structured - * @param inner_vectors - number of vectors, i.e. gridpoints, in the inner - * @param stripes_per_plane - number of stripes forming a plane - * @param vectors_per_stripe - number of vectors a stripe should contain - - From the list of vectors the blockvector-list is generated in - the following way: - The first blockvector level consists of 2 blockvectors: the first - covering all inner vectors (number 0), the second all other vectors - (number 1). Beginning - at the start of the vector-list, plane-blockvectors are constructed: each - plane-blockvector consists of a blockvector list of 'stripes_per_plane' - stripe-blockvectors and each - stripe-blockvector contains 'vectors_per_stripe' vectors. Plane-blocks are - constructed as long as not 'inner_vectors' vectors are processed - or all vectors in the grid are processed. The start of the new - plane-blockvector-list is anchored in the blockvector for the - inner vectors. The blockvectors in each list are - numbered beginning from 0 along the construction. If the vector-list - is shorter than 'inner_vectors', the function will not be troubled - and GM_INCONSISTENCY is returned. If the vector-list - is longer than 'vectors', these vectors are covered in a separate - blockvector with number 1 (this overlapping vectors might be for - example dirichlet boundary vectors). - - REQUIREMENTS: - The macro '__BLOCK_VECTOR_DESC__' must be defined in 'gm.h' to enable - blockvector descriptions. - - APPLICATION: - If the vector-list is ordered lexicographic and each line contains - 'vectors_per_stripe' vectors and each plane contains 'stripes_per_plane' - lines, then this function constructs the blockvector structure belonging - to a `plane- and linewise domain decomposition`. - - * @return <ul> - * <li>GM_OK if ok </li> - * <li>GM_OUT_OF_MEM if there was not enough memory to allocate all blockvectors </li> - * <li>GM_INCONSISTENCY if the vector-list was too short </li> - * </ul> - * \sa - BLOCKVECTOR, CreateBVStripe2D, CreateBVDomainHalfening - - */ -/****************************************************************************/ - -INT NS_DIM_PREFIX CreateBVStripe3D( GRID *grid, INT inner_vectors, INT stripes_per_plane, INT vectors_per_stripe ) -{ -#ifdef __BLOCK_VECTOR_DESC__ - BLOCKVECTOR *bv_inner, *bv_boundary, *bv_plane, *prev; - VECTOR *v; - INT i, nr_planes, nr_vectors, ret; - BV_DESC bvd; - - if ( GFIRSTBV( grid ) != NULL ) - FreeAllBV( grid ); - - /* number of planes to be constructed */ - nr_planes = ( inner_vectors + stripes_per_plane*vectors_per_stripe - 1) / (stripes_per_plane*vectors_per_stripe); - - v = FIRSTVECTOR( grid ); - - (void)CreateBlockvector( grid, &bv_inner ); - if ( bv_inner == NULL ) - return GM_OUT_OF_MEM; - - (void)CreateBlockvector( grid, &bv_boundary ); - if ( bv_boundary == NULL ) - { - DisposeBlockvector( grid, bv_inner ); - return GM_OUT_OF_MEM; - } - - GFIRSTBV( grid ) = bv_inner; /* anchor blockvector list in the grid */ - GLASTBV( grid ) = bv_boundary; - - BVPRED( bv_inner ) = NULL; - BVSUCC( bv_inner ) = bv_boundary; - BVNUMBER( bv_inner ) = 0; - SETBVDOWNTYPE( bv_inner, BVDOWNTYPEBV ); /* block is parent for all planes */ - SETBVTVTYPE( bv_inner, BV1DTV ); - SETBVORIENTATION( bv_inner, BVNOORIENTATION ); - BVFIRSTVECTOR( bv_inner ) = v; - - BVPRED( bv_boundary ) = bv_inner; - BVSUCC( bv_boundary ) = NULL; - BVNUMBER( bv_boundary ) = 1; - SETBVDOWNTYPE( bv_boundary, BVDOWNTYPEVECTOR ); /* block is at last block level */ - SETBVTVTYPE( bv_boundary, BV1DTV ); - SETBVORIENTATION( bv_boundary, BVNOORIENTATION ); - - /* construct for each plane a blockvector-tree */ - BVD_INIT( &bvd ); - BVD_PUSH_ENTRY( &bvd, 0, &three_level_bvdf ); /* inner vectors */ - BVD_PUSH_ENTRY( &bvd, 0, &three_level_bvdf ); /* 1. plane */ - nr_vectors = 0; - for ( i = 0; (i < nr_planes) && (v != NULL); i++ ) - { - if ( i != 0 ) - v = SUCCVC( v ); /* set v from the last vector of the previous block to the first of the current block */ - - ret = CreateBVPlane( &bv_plane, &bvd, &three_level_bvdf, &v, stripes_per_plane, vectors_per_stripe, grid ); - SETBVTVTYPE( bv_plane, BV2DTV ); /* use tensor product testvector (full 2D testvector) */ - if ( ret == GM_OUT_OF_MEM ) - { - FreeAllBV( grid ); - return ret; - } - - if ( i == 0 ) - { - BVDOWNBV( bv_inner ) = bv_plane; /* anchor stripe-blocks in the block of the plane */ - BVPRED( bv_plane ) = NULL; - } - else - { - BVSUCC( prev ) = bv_plane; /* continue blockvector list */ - BVPRED( bv_plane ) = prev; - } - - prev = bv_plane; /* prepare for the next loop */ - - BVNUMBER( bv_plane ) = i; - nr_vectors += BVNUMBEROFVECTORS( bv_plane ); - - BVD_INC_LAST_ENTRY( &bvd, 1, &three_level_bvdf ); - } - BVSUCC( bv_plane ) = NULL; /* end of the blockvector list */ - - BVLASTVECTOR( bv_inner ) = v; - BVDOWNBVLAST( bv_inner ) = bv_plane; - BVNUMBEROFVECTORS( bv_inner ) = nr_vectors; - - v = SUCCVC( v ); - BVFIRSTVECTOR( bv_boundary ) = v; - BVLASTVECTOR( bv_boundary ) = LASTVECTOR( grid ); - BVNUMBEROFVECTORS( bv_boundary ) = NVEC( grid ) - BVNUMBEROFVECTORS( bv_inner ); - - /* complete the boundary vector list */ - BVD_INIT( &bvd ); - BVD_PUSH_ENTRY( &bvd, 1, &three_level_bvdf ); /* boundary vectors */ - for ( ; v != NULL; v = SUCCVC( v ) ) - VBVD( v ) = bvd; - - if ( ret != GM_OK ) - return ret; - - if ( BVNUMBEROFVECTORS(bv_inner) != nr_planes*stripes_per_plane*vectors_per_stripe ) - return GM_INCONSISTENCY; - - SetLevelnumberBV( bv_inner, 0 ); - - return GM_OK; - -#else - return(1); -#endif /* __BLOCK_VECTOR_DESC__ */ -} - - -/****************************************************************************/ -/** \brief Creates a recursive domain halfening decomposition - - * @param grid - the grid containing the vectors to be structured - * @param side - number of points on the side of the quadratic mesh - - The grid must be similar to a quadratic mesh. The vectors must be numbered - linewise lexicographic. Then this function constructs a hierarchy - of blockvectors describing a recursive domain halfening. - - A quadratic domain is halfened by cutting along a vertical line. The - points on this line are gathered into subdomain with number 2. The points - left to this interface-line are collected in subdomain 0, the right ones - into subdomain 1. The subdomains are listed according to their numbers. - Each of the 2 resulting subdomains 0 and 1 are now halfened horizontally - and processed analogical. The halfening is recursively proceeded until - a subdomain consists of less than 10 points. The initial grid should have - a side length allowing all halfenings without a remainder. - - The first blockvector in the hierarchy is covering all the vectors. - - NOTE: - If the grid contains Dirichlet vectors, they must be hidden from this - routine; e.g. order the whole vector list such that the Dirichlet vectors - are at the end of the list; then let the LASTVECTOR of the grid be the - vector in front of the first Dirichlet vector and correct this temporarly - setting after returning from this routine. - - * @return <ul> - * <li> GM_OK if ok </li> - * <li> GM_OUT_OF_MEM if there is not enough memory to allocate the blockvectors </li> - **</ul> - * \sa - BLOCKVECTOR, CreateBVStripe - - */ -/****************************************************************************/ - -#ifndef ModelP -INT NS_DIM_PREFIX CreateBVDomainHalfening( GRID *grid, INT side, INT leaf_size ) -{ -#ifdef __BLOCK_VECTOR_DESC__ - BLOCKVECTOR *bv; - INT ret; - VECTOR *v, *end_v; - - if ( GFIRSTBV( grid ) != NULL ) - FreeAllBV( grid ); - - /* create first block of the hierarchy */ - if ( CreateBlockvector( grid, &bv ) != GM_OK ) - return GM_OUT_OF_MEM; - - GFIRSTBV( grid ) = bv; - GLASTBV( grid ) = bv; - SETBVDOWNTYPE( bv, BVDOWNTYPEVECTOR ); - SETBVTVTYPE( bv, BV1DTV ); - BVDOWNVECTOR( bv ) = FIRSTVECTOR( grid ); - BVPRED( bv ) = NULL; - BVSUCC( bv ) = NULL; - BVNUMBER( bv ) = 0; - BVLASTVECTOR( bv ) = LASTVECTOR( grid ); - BVFIRSTVECTOR( bv ) = FIRSTVECTOR( grid ); - - /* set this global blockvector as the first stage of the hierarchy */ - end_v = SUCCVC(LASTVECTOR( grid )); - #ifdef __BLOCK_VECTOR_DESC__ - for ( v = FIRSTVECTOR( grid ); v != end_v; v = SUCCVC( v ) ) - BVD_PUSH_ENTRY( &VBVD( v ), 0, &DH_bvdf ); - #endif - - if ( (ret = BlockHalfening( grid, bv, 0, 0, side, side, side, BV_VERTICAL, leaf_size )) != GM_OK ) - { - FreeAllBV( grid ); - return ret; - } - - /* set the number of covered VECTORS */ - BVNUMBEROFVECTORS( bv ) = BVNUMBEROFVECTORS( BVDOWNBV(bv) ) + - BVNUMBEROFVECTORS( BVSUCC(BVDOWNBV(bv)) ) + - BVNUMBEROFVECTORS( BVDOWNBVLAST(bv) ); - - /* set FIRST- and LASTVECTOR */ - FIRSTVECTOR( grid ) = BVFIRSTVECTOR( bv ); - LASTVECTOR( grid ) = BVLASTVECTOR( bv ); - - return GM_OK; -#else - return(1); -#endif /* __BLOCK_VECTOR_DESC__ */ -} -#endif /* ModelP */ - -#ifdef __BLOCK_VECTOR_DESC__ -/****************************************************************************/ -/** \brief Internal function to perform the work of CreateBVDomainHalfening - - * @param grid - the grid containing the vectors to be structured - * @param bv - blockvector to be subdivided - * @param left - left side of the rectangle representing the 'bv' in the virtual mesh - * @param bottom - bottom side of the rectangle representing the 'bv' in the virtual mesh - * @param width - sidewidth of the rectangle representing the 'bv' in the virtual mesh - * @param height - sideheight of the rectangle representing the 'bv' in the virtual mesh - * @param side - sidelength of the original square - * @param orientation - gives the orientation of the cutting line (horizontal or vertical) - - Performs the work described for the function CreateBVDomainHalfening - above. - - Consider a virtual equidistant mesh with meshwidth 1 in both directions. - Together with the linewise lexicographic numbering of the vectors you can - easily calculate the geometric position of each vector according to his - number in this mesh. In this way it is easy to determine to which - subdomain a given vector belongs. The "geometric" information to this - function are related to this virtual mesh. - - * @return <ul> - * <li> GM_OK if ok </li> - * <li> GM_OUT_OF_MEM if there is not enough memory to allocate the blockvectors </li> - * </ul> - */ -/****************************************************************************/ - -static INT BlockHalfening( GRID *grid, BLOCKVECTOR *bv, INT left, INT bottom, INT width, INT height, INT side, INT orientation, INT leaf_size ) -{ - VECTOR *v, *vpred, *end_v, **v0, **v1, **vi; - BLOCKVECTOR *bv0, *bv1, *bvi; - INT index, interface, nr_0, nr_1, nr_i; - VECTOR *pred_first_vec; - - #ifndef __BLOCK_VECTOR_DESC__ - return(1); - #endif - - /* create a double linked list of 3 blockvectors */ - v = BVFIRSTVECTOR( bv ); - end_v = BVENDVECTOR( bv ); - pred_first_vec = PREDVC( v ); - - if ( CreateBlockvector( grid, &bv0 ) != GM_OK ) - return GM_OUT_OF_MEM; - - BVPRED( bv0 ) = NULL; - SETBVDOWNTYPE( bv0, BVDOWNTYPEVECTOR ); - SETBVTVTYPE( bv0, BV1DTV ); - BVNUMBER( bv0 ) = 0; - v0 = &BVDOWNVECTOR( bv0 ); - - if ( CreateBlockvector( grid, &bv1 ) != GM_OK ) - { - DisposeBlockvector( grid, bv0 ); - return GM_OUT_OF_MEM; - } - - BVSUCC( bv0 ) = bv1; - BVPRED( bv1 ) = bv0; - SETBVDOWNTYPE( bv1, BVDOWNTYPEVECTOR ); - SETBVTVTYPE( bv1, BV1DTV ); - BVNUMBER( bv1 ) = 1; - v1 = &BVDOWNVECTOR( bv1 ); - - if ( CreateBlockvector( grid, &bvi ) != GM_OK ) - { - DisposeBlockvector( grid, bv1 ); - DisposeBlockvector( grid, bv0 ); - return GM_OUT_OF_MEM; - } - - BVSUCC( bv1 ) = bvi; - BVPRED( bvi ) = bv1; - SETBVDOWNTYPE( bvi, BVDOWNTYPEVECTOR ); - SETBVTVTYPE( bvi, BV1DTV ); - BVNUMBER( bvi ) = 2; - BVSUCC( bvi ) = NULL; - vi = &BVDOWNVECTOR( bvi ); - - /* all necessary memory allocated; insert new block list in father block */ - SETBVDOWNTYPE( bv, BVDOWNTYPEBV ); - SETBVTVTYPE( bv, BV1DTV ); - BVDOWNBV( bv ) = bv0; - BVDOWNBVLAST( bv ) = bvi; - - /* coordinate of the interface line */ - interface = ( (orientation == BV_VERTICAL) ? (width-1)/2 + left : bottom + (height-1)/2 ); - - /* sort each vector in one of the 3 subdomains */ - nr_0 = nr_1 = nr_i = 0; - for ( vpred = NULL; v != end_v; vpred = v, v = SUCCVC( v ) ) - { - /* calculate row/column number from index */ - index = ( (orientation == BV_VERTICAL) ? VINDEX(v) % side : VINDEX(v) / side ); - - if ( index < interface ) - { - /* vector belongs to subdomain 0 */ - *v0 = v; - v0 = &SUCCVC( v ); - #ifdef __BLOCK_VECTOR_DESC__ - BVD_PUSH_ENTRY( &VBVD( v ), 0, &DH_bvdf ); - #endif - nr_0++; - } - else if ( index > interface ) - { - /* vector belongs to subdomain 1 */ - *v1 = v; - v1 = &SUCCVC( v ); - #ifdef __BLOCK_VECTOR_DESC__ - BVD_PUSH_ENTRY( &VBVD( v ), 1, &DH_bvdf ); - #endif - nr_1++; - } - else - { - /* vector belongs to subdomain 2 (interface) */ - *vi = v; - vi = &SUCCVC( v ); - #ifdef __BLOCK_VECTOR_DESC__ - BVD_PUSH_ENTRY( &VBVD( v ), 2, &DH_bvdf ); - #endif - nr_i++; - } - - } - - /* relink the 3 subdomain lists to the global vector list */ - *v0 = BVDOWNVECTOR( bv1 ); - *v1 = BVDOWNVECTOR( bvi ); - *vi = end_v; - v = BVDOWNVECTOR( bv0 ); - vpred = pred_first_vec; - if ( pred_first_vec != NULL ) - SUCCVC( pred_first_vec ) = v; - /* correct the PRED-pointer chain */ - for ( ; v != end_v; vpred = v, v = SUCCVC( v ) ) - PREDVC( v ) = vpred; - if ( v != NULL ) /* at the end of the vectors of this blockvector */ - PREDVC( v ) = vpred; - - BVNUMBEROFVECTORS( bv0 ) = nr_0; - BVNUMBEROFVECTORS( bv1 ) = nr_1; - BVNUMBEROFVECTORS( bvi ) = nr_i; - - /* complete the relation between blockvectors and vectors */ - BVLASTVECTOR( bv0 ) = BVPRED(BVDOWNVECTOR( bv1 )); - BVLASTVECTOR( bv1 ) = BVPRED(BVDOWNVECTOR( bvi )); - BVLASTVECTOR( bvi ) = vpred; - BVLASTVECTOR( bv ) = vpred; - - BVFIRSTVECTOR( bv0 ) = BVDOWNVECTOR( bv0 ); - BVFIRSTVECTOR( bv1 ) = BVDOWNVECTOR( bv1 ); - BVFIRSTVECTOR( bvi ) = BVDOWNVECTOR( bvi ); - BVFIRSTVECTOR( bv ) = BVFIRSTVECTOR( bv0 ); - - /* next loop */ - - if ( orientation == BV_VERTICAL ) - { - /* new dimensions */ - width = ( width - 1 ) / 2; - - /* if there are too many points per subdomain halfen them */ - if ( ( width * height ) > leaf_size ) - { - if ( BlockHalfening( grid, bv0, left, bottom, width, height, side, BV_HORIZONTAL, leaf_size ) == GM_OUT_OF_MEM ) - return GM_OUT_OF_MEM; - if ( BlockHalfening( grid, bv1, left+width+1, bottom, width, height, side, BV_HORIZONTAL, leaf_size ) == GM_OUT_OF_MEM ) - return GM_OUT_OF_MEM; - } - } - else /* orientation == BV_HORIZONTAL */ - { - /* new dimensions */ - height = ( height - 1 ) / 2; - - /* if there are too many points per subdomain halfen them */ - if ( ( width * height ) > leaf_size ) - { - if ( BlockHalfening( grid, bv0, left, bottom, width, height, side, BV_VERTICAL, leaf_size ) == GM_OUT_OF_MEM ) - return GM_OUT_OF_MEM; - if ( BlockHalfening( grid, bv1, left, bottom +height+1, width, height, side, BV_VERTICAL, leaf_size ) == GM_OUT_OF_MEM ) - return GM_OUT_OF_MEM; - } - } - - return GM_OK; -} -#endif /* __BLOCK_VECTOR_DESC__ */ - - /****************************************************************************/ /** \brief Move vector within the vector list of the grid diff --git a/gm/gm.doc b/gm/gm.doc index a8f9b2048..8bdac6e0a 100644 --- a/gm/gm.doc +++ b/gm/gm.doc @@ -2043,10 +2043,6 @@ RELATED~FUNCTIONS: . FindBV - Find the described blockvector in the grid. -. CreateBVStripe - Creates a stripewise domain decomposition. - -. CreateBVDomainHalfening - Creates a recursive domain halfening decomposition. - . blas~routines~for~BLOCKVECTOR - ~ EXAMPLES: @@ -2082,7 +2078,7 @@ The second variant uses a BV_DESC instead of the pointer:~ \sa VECTOR, MATRIX, BV_DESC, BV_DESC_FORMAT, BLOCKNUMBER, BLOCKLEVEL, CreateBlockvector, DisposeBlockvector, FreeAllBV, FreeBVList, FindBV, -CreateBVStripe, CreateBVDomainHalfening , blas_routines. +blas_routines. */ diff --git a/gm/gm.h b/gm/gm.h index 52c691f8c..8dbc8c525 100644 --- a/gm/gm.h +++ b/gm/gm.h @@ -3462,11 +3462,6 @@ INT InitBVDF ( BV_DESC_FORMAT *bvdf, /* handling struct blockvector_description (BV_DESC) */ INT PushEntry ( BV_DESC *bvd, BLOCKNUMBER bnr, const BV_DESC_FORMAT *bvdf ); -/* functions to create a BLOCKVECTOR structure for a regular rectangular grid */ -INT CreateBVStripe2D ( GRID *grid, INT vectors, INT vectors_per_stripe ); -INT CreateBVStripe3D ( GRID *grid, INT inner_vectors, INT stripes_per_plane, INT vectors_per_stripe ); -INT CreateBVDomainHalfening ( GRID *grid, INT side, INT leaf_size ); - /* general functions for BLOCKVECTOR */ INT CreateBlockvector ( GRID *theGrid, BLOCKVECTOR **BVHandle ); INT CreateBlockvector_l0 ( GRID *theGrid, BLOCKVECTOR **BVHandle, BLOCKVECTOR *insertBV, INT after); -- GitLab