Exemple #1
0
void load_objects_gl(Object *objs)
{
  Object *o; iMesh *m;

  for (o = objs; o != NULL; o = o->next) {
    setup_texture(o);
    switch (o->type) {
    case V_TRIMESH:
      if (mesh_(o)->nv == NULL)
	imesh_compute_normals(mesh_(o)); 
      vbo_store_mesh_gl(o, mesh_(o)); 
      break;
    case V_PRIM:
      m = prim_mesh(prim_(o), prim_uv_decomp(prim_(o), 1.));
      vbo_store_mesh_gl(o, m); 
      break;
    case V_GROUP:
      load_objects_gl(children_(o));
      break;
    default: error("(load_obj_gl) wrong type");
    }
  }
}
void Foam::faAreaMapper::calcAddressing() const
{
    if
    (
        newFaceLabelsPtr_
     || newFaceLabelsMapPtr_
     || directAddrPtr_
     || interpolationAddrPtr_
     || weightsPtr_
     || insertedObjectLabelsPtr_
    )
    {
        FatalErrorIn("void faAreaMapper::calcAddressing() const)")
            << "Addressing already calculated"
            << abort(FatalError);
    }

    // Mapping

    const label oldNInternal = mpm_.nOldInternalFaces();

    // Calculate new face labels

    // Copy old face labels
    const labelList& oldFaces = mesh_.faceLabels();

    // Prepare a list of new face labels and (preliminary) addressing
    // Note: dimensioned to number of boundary faces of polyMesh
    // HJ, 10/Aug/2011
    newFaceLabelsPtr_ = new labelList
    (
        mesh_().nFaces() - mesh_().nInternalFaces(),
        -1
    );
    labelList& newFaceLabels = *newFaceLabelsPtr_;

    newFaceLabelsMapPtr_ = new labelList
    (
        mesh_().nFaces() - mesh_().nInternalFaces(),
        -1
    );
    labelList& newFaceLabelsMap = *newFaceLabelsMapPtr_;
    label nNewFaces = 0;

    Info<< "Old face list size: " << oldFaces.size()
        << " estimated new size " << newFaceLabels.size() << endl;

    // Get reverse face map
    const labelList& reverseFaceMap = mpm_.reverseFaceMap();

    // Pick up live old faces
    forAll (oldFaces, faceI)
    {
        if (reverseFaceMap[oldFaces[faceI]] > -1)
        {
            // Face is live, add it and record addressing
            newFaceLabels[nNewFaces] = reverseFaceMap[oldFaces[faceI]];
            newFaceLabelsMap[nNewFaces] = faceI;

            nNewFaces++;
        }
    }

    // Assemble the maps
    if (direct())
    {
        Info<< "Direct"<< endl;
        // Direct mapping: no further faces to add.  Resize list
        newFaceLabels.setSize(nNewFaces);

        directAddrPtr_ = new labelList(newFaceLabels.size());
        labelList& addr = *directAddrPtr_;

        // Adjust for creation of a boundary face from an internal face
        forAll (addr, faceI)
        {
            if (newFaceLabelsMap[faceI] < oldNInternal)
            {
                addr[faceI] = 0;
            }
            else
            {
                addr[faceI] = newFaceLabelsMap[faceI];
            }
        }
    }
    else
    {