Esempio n. 1
0
static void FreeLinks( Geometry_t *Geom )
{
     GeometryList_t *Link=Geom->Link, *Link1;

     while( Link )
     {
        Link1 = Link->Next;
        free(Link);
        Link = Link1;
     }
     Geom->Link = NULL;

     if ( Geom->Flags & GEOMETRY_FLAG_LEAF ) 
     {
        Geom->Flags &= ~GEOMETRY_FLAG_LEAF;
        return;
     }

     if ( Geom->Left )  FreeLinks( Geom->Left );
     if ( Geom->Right ) FreeLinks( Geom->Right );
}
Esempio n. 2
0
 inline ~VShapeLinkConfig()
 {
   FreeLinks();
 }
Esempio n. 3
0
/*******************************************************************************

Compute viewfactors for elements of the model, and solve for Gebhardt factors,
or radiosity, if requested.

24 Aug 1995

*******************************************************************************/
static void IntegrateFromGeometry(int N,double *Factors)
{
    double T,s,F,Fmin=DBL_MAX,Fmax=-DBL_MAX,Favg=0.0,*RowSums,Fact;
    int i,j,k,Imin,Imax;

    GeometryList_t *Link;

    for( i=0; i<N; i++ )
    {
        Elements[i].Area = (*AreaCompute[Elements[i].GeometryType])(&Elements[i]);
        Elements[i].Flags |= GEOMETRY_FLAG_LEAF;
    }

    RowSums = (double *)calloc( N,sizeof(double) );

    MaxLev = 0;
    k = 0;
    for( i=0; i<N; i++ )
    {
         for( j=i; j<N; j++ ) Factors[i*N+j] = 0.0;
         if ( Elements[i].Area<1.0e-10 ) continue;

         fprintf( stdout, "row = % 4d of %d: ",i+1,N );
         for( j=i+1; j<N; j++ )
         { 
            if ( Elements[j].Area<1.0e-10 ) continue;

            FreeLinks( &Elements[i] );
            FreeLinks( &Elements[j] );

            Elements[i].Flags |= GEOMETRY_FLAG_LEAF;
            Elements[j].Flags |= GEOMETRY_FLAG_LEAF;

            (*ViewFactorCompute[Elements[i].GeometryType])( &Elements[i],&Elements[j],0,0 );
  
            Fact = ComputeViewFactorValue( &Elements[i],0 );
            Factors[i*N+j] = Fact / Elements[i].Area;
            Factors[j*N+i] = Fact / Elements[j].Area;
         }

         fflush( stdout );

         FreeChilds( Elements[i].Left );
         Elements[i].Left = NULL;

         FreeChilds( Elements[i].Right );
         Elements[i].Right = NULL;

         RowSums[i] = 0.0;
         for( j=0; j<N; j++ )
         {
           if ( Elements[j].Area < 1.0e-10 ) continue;
           RowSums[i] += Factors[i*N+j];
         }
         s = RowSums[i];
         if ( s < Fmin )
         {
            Fmin = s;
            Imin = i+1;
         }
         if ( s > Fmax )
         {
            Fmax = s;
            Imax = i+1;
         }
         Favg += s;
         k++;

         fprintf( stdout, "sum=%-4.2f, (min(%d)=%-4.2f, max(%d)=%-4.2f, avg=%-4.2f)\n", 
                        s,Imin,Fmin,Imax,Fmax,Favg/k );
    }

    free( RowSums );
}