Logo Search packages:      
Sourcecode: necpp version File versions  Download package

void c_geometry::geometry_complete ( nec_context in_context,
int  card_int_1,
int  card_int_2 
)

Geometry is complete

Exceptions:
nec_exception* If there is an error with the geometry.

We have finished with the geometry description, now connect things up.

Definition at line 525 of file c_geometry.cpp.

References nec_context::plot_card, c_plot_card::plot_segments(), safe_array< T >::resize(), and c_plot_card::set_plot_real_imag_currents().

Referenced by nec_context::geometry_complete(), and parse_geometry().

{
      if (0 == np + mp)
            throw new nec_exception("Geometry has no wires or patches.");
            
      /* TCAM: The following does not make sense for the semantics of the plot
      card. I have left this in, I hope someone will tell me why it is required.
      */
      if (card_int_2 != 0)
            in_context->plot_card.set_plot_real_imag_currents();
            
      // now proceed and complete the geometry setup...
      
      connect_segments( card_int_1);

      if ( n != 0)
      {
            /* Allocate wire buffers */
            segment_length.resize(n);
            sab.resize(n);
            cab.resize(n);
            salp.resize(n);
      
            m_output->nec_printf( "\n\n\n"
                  "                              "
                  " ---------- SEGMENTATION DATA ----------\n"
                  "                                       "
                  " COORDINATES IN METERS\n"
                  "                           "
                  " I+ AND I- INDICATE THE SEGMENTS BEFORE AND AFTER I\n" );
      
            m_output->nec_printf( "\n"
                  "   SEG    COORDINATES OF SEGM CENTER     SEGM    ORIENTATION"
                  " ANGLES    WIRE    CONNECTION DATA   TAG\n"
                  "   No:       X         Y         Z      LENGTH     ALPHA     "
                  " BETA    RADIUS    I-     I    I+   NO:" );
      
            for(int i = 0; i < n; i++ )
            {
                  nec_float xw1= x2[i]- x[i];
                  nec_float yw1= y2[i]- y[i];
                  nec_float zw1= z2[i]- z[i];
                  x[i]=( x[i]+ x2[i])*.5;
                  y[i]=( y[i]+ y2[i])*.5;
                  z[i]=( z[i]+ z2[i])*.5;
                  
                  nec_float xw2= xw1* xw1+ yw1* yw1+ zw1* zw1;
                  nec_float yw2= sqrt( xw2);
                  yw2=( xw2/ yw2+ yw2)*.5;
                  segment_length[i]= yw2;
                  cab[i]= xw1/ yw2;
                  sab[i]= yw1/ yw2;
                  xw2= zw1/ yw2;
      
                  if ( xw2 > 1.)
                        xw2=1.;
                  if ( xw2 < -1.)
                        xw2=-1.;
      
                  salp[i]= xw2;
                  xw2= rad_to_degrees(asin( xw2));
                  yw2= rad_to_degrees(atan2( yw1, xw1));
      
                  m_output->nec_printf( "\n"
                        " %5d %9.4f %9.4f %9.4f %9.4f"
                        " %9.4f %9.4f %9.4f %5d %5d %5d %5d",
                        i+1, x[i], y[i], z[i], segment_length[i], xw2, yw2,
                        segment_radius[i], icon1[i], i+1, icon2[i], segment_tags[i] );
      
                  in_context->plot_card.plot_segments(i,x,y,z,segment_length,xw2,yw2,segment_radius,icon1,icon2);
      
                  if ( (segment_length[i] <= 1.e-20) || (segment_radius[i] <= 0.) )
                  {
                        throw new nec_exception("SEGMENT DATA ERROR" );
                  }
            } /* for( i = 0; i < n; i++ ) */
      } /* if ( n != 0) */

      if ( m != 0)
      {
            m_output->nec_printf( "\n\n\n"
                  "                                   "
                  " --------- SURFACE PATCH DATA ---------\n"
                  "                                            "
                  " COORDINATES IN METERS\n\n"
                  " PATCH      COORD. OF PATCH CENTER           UNIT NORMAL VECTOR      "
                  " PATCH           COMPONENTS OF UNIT TANGENT VECTORS\n"
                  "  NO:       X          Y          Z          X        Y        Z      "
                  " AREA         X1       Y1       Z1        X2       Y2      Z2" );
      
            for(int i = 0; i < m; i++ )
            {
                  nec_float xw1=( t1y[i]* t2z[i]- t1z[i]* t2y[i])* psalp[i];
                  nec_float yw1=( t1z[i]* t2x[i]- t1x[i]* t2z[i])* psalp[i];
                  nec_float zw1=( t1x[i]* t2y[i]- t1y[i]* t2x[i])* psalp[i];
      
                  m_output->nec_printf( "\n"
                        " %4d %10.5f %10.5f %10.5f  %8.4f %8.4f %8.4f"
                        " %10.5f  %8.4f %8.4f %8.4f  %8.4f %8.4f %8.4f",
                        i+1, px[i], py[i], pz[i], xw1, yw1, zw1, pbi[i],
                        t1x[i], t1y[i], t1z[i], t2x[i], t2y[i], t2z[i] );
            } /* for( i = 0; i < m; i++ ) */
      } /* if ( m == 0) */

      n_plus_m  = n+m;
      n_plus_2m = n+2*m;
      n_plus_3m = n+3*m;

      x_unscaled.resize(n);
      y_unscaled.resize(n);
      z_unscaled.resize(n);
      si_unscaled.resize(n);
      bi_unscaled.resize(n);
      
      px_unscaled.resize(m);
      py_unscaled.resize(m);
      pz_unscaled.resize(m);
      pbi_unscaled.resize(m);
      
      // Fill the unscaled segments...
      for (int i = 0; i < n; i++ )
      {
            x_unscaled[i]= x[i];
            y_unscaled[i]= y[i];
            z_unscaled[i]= z[i];
            si_unscaled[i]= segment_length[i];
            bi_unscaled[i]= segment_radius[i];
      }
      // Fill the unscaled patches...
      for (int i = 0; i < m; i++ )
      {
            px_unscaled[i]= px[i];
            py_unscaled[i]= py[i];
            pz_unscaled[i]= pz[i];
            pbi_unscaled[i]= pbi[i];
      }
}


Generated by  Doxygen 1.6.0   Back to index