Example #1
0
int main(int argc, char *argv[])
{
    
    // Define the system
    double rel_rad_spheroid[NLAYERS][2] = { { 0.8, 0.8 },
                                            { 0.2, 0.2 }
                                            };
    double rad[2] = { 10.0, 10.0 };

    // Prep the material index
    initiallize_material_index();

    // Main solver test
    int i, indx[NLAYERS] = { material_index("Ag"), material_index("Au") };
    double qext[NLAMBDA], qscat[NLAMBDA], qabs[NLAMBDA];

    npsolve(NLAYERS, rad, rel_rad_spheroid, indx, MEDIUMDIE, FALSE, FALSE,
            1.0, 1.0, Efficiency, qext, qscat, qabs);
    printf("\n\nTHIS IS CTEST\n\n");
    for (i = 0; i < 20; i++) {
        printf("NPSolve: Ext %.16f, Sca %.16f, Abs %.16f\n", qext[i], qscat[i], qabs[i]);
    }

    return 0;
}
Example #2
0
const char *MaterialList::add_material(const char *newname, 
                                       const char *copyfrom) {
  int copyind = 0;
  if (copyfrom) {
    copyind = material_index(copyfrom);
    if (copyind < 0) return NULL;  // material to copy from does not exist
  }
  char buf[20];
  const char *name = newname;
  if (!name) {
    // find a new unique name.
    int id = mlist->num();
    do {
      sprintf(buf, "Material%d", id++);
      name = buf;
    } while (mlist->typecode(name) >= 0);
  } else {
    if (mlist->typecode(name) >= 0)
      return NULL; // name already present
  }
  Material *newmat = new Material;
  memcpy(newmat, mlist->data(copyind), sizeof(Material));
  newmat->ind = matcounter++;
  int ind = mlist->add_name(name, newmat);
  return mlist->name(ind);
} 
Example #3
0
    //---------------------------------------------------------------------
    void
    PFile::addGroup( const Group &group, ManualObject &mo
                    ,const String &sub_name, const String &material_base_name
                    ,const Ogre::Bone *bone ) const
    {
        size_t material_index( 0 );
        if( group.has_texture )
        {
            material_index = group.texture_index + 1;
        }
        String material_name( material_base_name + "/" + Ogre::StringConverter::toString( material_index ) );
        const uint16 bone_handle( bone->getHandle() );
        const Ogre::Vector3 bone_position( getPosition( bone ) );

        size_t index( 0 );
        size_t vertex_count( group.num_polygons * 3 );
        size_t index_count( vertex_count );
        size_t polygon_end_index( group.polygon_start_index + group.num_polygons );
        mo.begin( sub_name, material_name, vertex_count, index_count );
        for( size_t p( group.polygon_start_index ); p < polygon_end_index; ++p )
        {
            const PolygonDefinition& polygon( m_polygon_definitions[p] );
            for( int i(3); i--; )
            {
                uint32 v( group.vertex_start_index
                         +polygon.vertex[i] )
                      ,n( 0 + polygon.normal[i] )
                      ,t( group.texture_coordinate_start_index
                         +polygon.vertex[i] );
                Ogre::Vector3 pos( m_vertices[ v ] );
                mo.position((STATIC_ROTATION *  (pos / HRCFile::kDownScaler)) + bone_position);
                mo.colour( m_vertex_colors[ v ] );
                mo.normal( STATIC_ROTATION * m_normals[ n ] );
                if( group.has_texture )
                {
                    mo.textureCoord(m_texture_coordinates[t]);
                }
                mo.bone( index, bone_handle );
                mo.index( index++ );
            }
        }
        mo.end();
    }