Dumps faces of a mesh to stdout.<p>

@param mesh the mesh
192991
public static void dumpFaces(AiMesh mesh) {
        if (!mesh.hasFaces()) {
            System.out.println("mesh has no faces");
            return;
        }
        
        for (int face = 0; face < mesh.getNumFaces(); face++) {
            int faceNumIndices = mesh.getFaceNumIndices(face);
            System.out.print(faceNumIndices + ": ");
            
            for (int vertex = 0; vertex < faceNumIndices; vertex++) {
                int reference = mesh.getFaceVertex(face, vertex);
                
                System.out.print("[" + 
                        mesh.getPositionX(reference) + ", " + 
                        mesh.getPositionY(reference) + ", " + 
                        mesh.getPositionZ(reference) + "] "
                        );
            }
            
            System.out.println();
        }
    }
1227328
private static byte[] dumpBytecode(MethodNode methodNode) {
        // Calculate label offsets -- required for hash calculation
          // we only care about where the labels are in relation to the opcode instructions -- we don't care about things like
          // LocalVariableNode or other ancillary data because these can change without the actual logic changing
        List<AbstractInsnNode> onlyInstructionsAndLabels = Arrays.stream(methodNode.instructions.toArray())
                .filter(x -> x instanceof LabelNode || x.getOpcode() != -1)
                .collect(Collectors.toList());
        Map<Label, Integer> labelOffsets = onlyInstructionsAndLabels.stream()
                .filter(x -> x instanceof LabelNode)
                .map(x -> (LabelNode) x)
                .collect(Collectors.toMap(x -> x.getLabel(), x -> onlyInstructionsAndLabels.indexOf(x)));


        // Hash based on overall structures and instructions+operands
        try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
                DataOutputStream daos = new DataOutputStream(baos);) {
            MethodVisitor daosDumpMethodVisitor = new DumpToDaosMethodVisitor(daos, labelOffsets);

            methodNode.accept(daosDumpMethodVisitor);
            daos.flush(); // doesn't really need it -- just incase
            
            return baos.toByteArray();
        } catch (IOException ioe) {
            throw new IllegalStateException(ioe); // should never happen
        }
    }
1311046
public void gridToPmesh(String outPutFileName) {
        try {
            gridGenerator.writeGridInPmeshFormat(outPutFileName);
        } catch (IOException e) {
            logger.debug(e);
        }
    }
658822
protected void addFacetPart(CmsSolrQuery query) {

        StringBuffer value = new StringBuffer();
        value.append("{!key=").append(m_config.getName());
        addFacetOptions(value);
        if (m_config.getIgnoreAllFacetFilters()
            || (!m_state.getCheckedEntries().isEmpty() && !m_config.getIsAndFacet())) {
            value.append(" ex=").append(m_config.getIgnoreTags());
        }
        value.append("}");
        value.append(m_config.getRange());
        query.add("facet.range", value.toString());
    }
856751
def out_shape_from_meshgrid(mesh):
    """"""
    if len(mesh) == 1:
        return (len(mesh[0]),)
    else:
        return np.broadcast(*mesh).shape
997773
public static void write (SimpleMisoSceneModel model, Json.Writer out) {
        out.object(); // outer
        out.value("width", model.width);
        out.value("height", model.height);
        out.value("viewwidth", model.vwidth);
        out.value("viewheight", model.vheight);

        out.array("base");
        for (int tileId : model.baseTileIds) out.value(tileId);
        out.end();

        out.array("objects");
        for (int ii = 0; ii < model.objectTileIds.length; ii++) {
            out.object();
            out.value("tileId", model.objectTileIds[ii]);
            out.value("x", model.objectXs[ii]);
            out.value("y", model.objectYs[ii]);
            out.end();
        }
        for (ObjectInfo info : model.objectInfo) {
            out.object();
            out.value("tileId", info.tileId);
            out.value("x", info.x);
            out.value("y", info.y);
            if (info.action != null) out.value("action", info.action);
            if (info.priority != 0) out.value("priority", info.priority);
            if (info.sx != 0 || info.sy != 0) {
                out.value("sx", info.sx);
                out.value("sy", info.sy);
                out.value("sorient", info.sorient);
            }
            if (info.zations != 0) out.value("zations", info.zations);
        }
        out.end(); // objects
        out.end(); // outer
    }
373923
def overwrite(self, mesh):
        
        self.DeepCopy(mesh)
        if is_vtki_obj(mesh):
            self.copy_meta_from(mesh)
561336
function (subMesh) {
                var mesh = subMesh.getRenderingMesh();
                if (_this._meshExcluded(mesh)) {
                    return;
                }
                var scene = mesh.getScene();
                var engine = scene.getEngine();
                // Culling
                engine.setState(subMesh.getMaterial().backFaceCulling);
                // Managing instances
                var batch = mesh._getInstancesRenderList(subMesh._id);
                if (batch.mustReturn) {
                    return;
                }
                var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);
                if (_this.isReady(subMesh, hardwareInstancedRendering)) {
                    var effect = _this._volumetricLightScatteringPass;
                    if (mesh === _this.mesh) {
                        if (subMesh.effect) {
                            effect = subMesh.effect;
                        }
                        else {
                            effect = subMesh.getMaterial().getEffect();
                        }
                    }
                    engine.enableEffect(effect);
                    mesh._bind(subMesh, effect, BABYLON.Material.TriangleFillMode);
                    if (mesh === _this.mesh) {
                        subMesh.getMaterial().bind(mesh.getWorldMatrix(), mesh);
                    }
                    else {
                        var material = subMesh.getMaterial();
                        _this._volumetricLightScatteringPass.setMatrix("viewProjection", scene.getTransformMatrix());
                        // Alpha test
                        if (material && material.needAlphaTesting()) {
                            var alphaTexture = material.getAlphaTestTexture();
                            _this._volumetricLightScatteringPass.setTexture("diffuseSampler", alphaTexture);
                            if (alphaTexture) {
                                _this._volumetricLightScatteringPass.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
                            }
                        }
                        // Bones
                        if (mesh.useBones && mesh.computeBonesUsingShaders) {
                            _this._volumetricLightScatteringPass.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
                        }
                    }
                    // Draw
                    mesh._processRendering(subMesh, _this._volumetricLightScatteringPass, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return effect.setMatrix("world", world); });
                }
            }
1314873
void writeMethod(MethodSymbol m) {
        int flags = adjustFlags(m.flags());
        databuf.appendChar(flags);
        if (dumpMethodModifiers) {
            PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
            pw.println("METHOD  " + fieldName(m));
            pw.println("---" + flagNames(m.flags()));
        }
        databuf.appendChar(pool.put(fieldName(m)));
        databuf.appendChar(pool.put(typeSig(m.externalType(types))));
        int acountIdx = beginAttrs();
        int acount = 0;
        if (m.code != null) {
            int alenIdx = writeAttr(names.Code);
            writeCode(m.code);
            m.code = null; // to conserve space
            endAttr(alenIdx);
            acount++;
        }
        List<Type> thrown = m.erasure(types).getThrownTypes();
        if (thrown.nonEmpty()) {
            int alenIdx = writeAttr(names.Exceptions);
            databuf.appendChar(thrown.length());
            for (List<Type> l = thrown; l.nonEmpty(); l = l.tail)
                databuf.appendChar(pool.put(l.head.tsym));
            endAttr(alenIdx);
            acount++;
        }
        if (m.defaultValue != null) {
            int alenIdx = writeAttr(names.AnnotationDefault);
            m.defaultValue.accept(awriter);
            endAttr(alenIdx);
            acount++;
        }
        if (options.isSet(PARAMETERS))
            acount += writeMethodParametersAttr(m);
        acount += writeMemberAttrs(m);
        acount += writeParameterAttrs(m);
        endAttrs(acountIdx, acount);
    }
298089
static void append(Appendable outputBuf, SoyValue value, SoyNode node) {
    try {
      value.render(outputBuf);
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (RenderException e) {
      throw e.addStackTraceElement(node);
    }
  }
72277
def export_ply(mesh,
               encoding='binary',
               vertex_normal=None):
    
    # evaluate input args
    # allow a shortcut for binary
    if encoding == 'binary':
        encoding = 'binary_little_endian'
    elif encoding not in ['binary_little_endian', 'ascii']:
        raise ValueError('encoding must be binary or ascii')
    # if vertex normals aren't specifically asked for
    # only export them if they are stored in cache
    if vertex_normal is None:
        vertex_normal = 'vertex_normal' in mesh._cache

    # custom numpy dtypes for exporting
    dtype_face = [('count', '<u1'),
                  ('index', '<i4', (3))]
    dtype_vertex = [('vertex', '<f4', (3))]
    # will be appended to main dtype if needed
    dtype_vertex_normal = ('normals', '<f4', (3))
    dtype_color = ('rgba', '<u1', (4))

    # get template strings in dict
    templates = json.loads(get_resource('ply.template'))
    # start collecting elements into a string for the header
    header = templates['intro']
    header += templates['vertex']

    # if we're exporting vertex normals add them
    # to the header and dtype
    if vertex_normal:
        header += templates['vertex_normal']
        dtype_vertex.append(dtype_vertex_normal)

    # if mesh has a vertex coloradd it to the header
    if mesh.visual.kind == 'vertex' and encoding != 'ascii':
        header += templates['color']
        dtype_vertex.append(dtype_color)

    # create and populate the custom dtype for vertices
    vertex = np.zeros(len(mesh.vertices),
                      dtype=dtype_vertex)
    vertex['vertex'] = mesh.vertices
    if vertex_normal:
        vertex['normals'] = mesh.vertex_normals
    if mesh.visual.kind == 'vertex':
        vertex['rgba'] = mesh.visual.vertex_colors

    header += templates['face']
    if mesh.visual.kind == 'face' and encoding != 'ascii':
        header += templates['color']
        dtype_face.append(dtype_color)

    # put mesh face data into custom dtype to export
    faces = np.zeros(len(mesh.faces), dtype=dtype_face)
    faces['count'] = 3
    faces['index'] = mesh.faces
    if mesh.visual.kind == 'face' and encoding != 'ascii':
        faces['rgba'] = mesh.visual.face_colors

    header += templates['outro']

    header_params = {'vertex_count': len(mesh.vertices),
                     'face_count': len(mesh.faces),
                     'encoding': encoding}

    export = Template(header).substitute(header_params).encode('utf-8')

    if encoding == 'binary_little_endian':
        export += vertex.tostring()
        export += faces.tostring()
    elif encoding == 'ascii':
        # ply format is: (face count, v0, v1, v2)
        fstack = np.column_stack((np.ones(len(mesh.faces),
                                          dtype=np.int64) * 3,
                                  mesh.faces))

        # if we're exporting vertex normals they get stacked
        if vertex_normal:
            vstack = np.column_stack((mesh.vertices,
                                      mesh.vertex_normals))
        else:
            vstack = mesh.vertices

        # add the string formatted vertices and faces
        export += (util.array_to_string(vstack,
                                        col_delim=' ',
                                        row_delim='\n') +
                   '\n' +
                   util.array_to_string(fstack,
                                        col_delim=' ',
                                        row_delim='\n')).encode('utf-8')
    else:
        raise ValueError('encoding must be ascii or binary!')

    return export
230319
private void clearFacesEvents(FacesContext context) {
        if (context.getRenderResponse() || context.getResponseComplete()) {
            if (events != null) {
                for (List<FacesEvent> eventList : events) {
                    if (eventList != null) {
                        eventList.clear();
                    }
                }
                events = null;
            }
        }
    }
35013
public void pspGridToPmesh(String outPutFileName) {
        try {
            gridGenerator.writeGridInPmeshFormat(outPutFileName, minPSPocket);
        } catch (IOException e) {
            logger.debug(e);
        }
    }
1275581
public static void dumpColorset(AiMesh mesh, int colorset) {
        if (!mesh.hasColors(colorset)) {
            System.out.println("mesh has no vertex color set " + colorset);
            return;
        }
        
        for (int i = 0; i < mesh.getNumVertices(); i++) {
            System.out.println("[" + 
                    mesh.getColorR(i, colorset) + ", " + 
                    mesh.getColorG(i, colorset) + ", " + 
                    mesh.getColorB(i, colorset) + ", " + 
                    mesh.getColorA(i, colorset) + "]"
                    );
        }
    }
915781
def write(filename, mesh, write_binary=True):
    
    if mesh.points.shape[1] == 2:
        logging.warning(
            "msh2 requires 3D points, but 2D points given. "
            "Appending 0 third component."
        )
        mesh.points = numpy.column_stack(
            [mesh.points[:, 0], mesh.points[:, 1], numpy.zeros(mesh.points.shape[0])]
        )

    if write_binary:
        for key, value in mesh.cells.items():
            if value.dtype != c_int:
                logging.warning(
                    "Binary Gmsh needs 32-bit integers (got %s). Converting.",
                    value.dtype,
                )
                mesh.cells[key] = numpy.array(value, dtype=c_int)

    # Gmsh cells are mostly ordered like VTK, with a few exceptions:
    cells = mesh.cells.copy()
    if "tetra10" in cells:
        cells["tetra10"] = cells["tetra10"][:, [0, 1, 2, 3, 4, 5, 6, 7, 9, 8]]
    if "hexahedron20" in cells:
        cells["hexahedron20"] = cells["hexahedron20"][
            :, [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 13, 9, 16, 18, 19, 17, 10, 12, 14, 15]
        ]

    with open(filename, "wb") as fh:
        mode_idx = 1 if write_binary else 0
        size_of_double = 8
        fh.write(
            ("$MeshFormat\n2.2 {} {}\n".format(mode_idx, size_of_double)).encode(
                "utf-8"
            )
        )
        if write_binary:
            fh.write(struct.pack("i", 1))
            fh.write("\n".encode("utf-8"))
        fh.write("$EndMeshFormat\n".encode("utf-8"))

        if mesh.field_data:
            _write_physical_names(fh, mesh.field_data)

        # Split the cell data: gmsh:physical and gmsh:geometrical are tags, the
        # rest is actual cell data.
        tag_data = {}
        other_data = {}
        for cell_type, a in mesh.cell_data.items():
            tag_data[cell_type] = {}
            other_data[cell_type] = {}
            for key, data in a.items():
                if key in ["gmsh:physical", "gmsh:geometrical"]:
                    tag_data[cell_type][key] = data.astype(c_int)
                else:
                    other_data[cell_type][key] = data

        _write_nodes(fh, mesh.points, write_binary)
        _write_elements(fh, cells, tag_data, write_binary)
        if mesh.gmsh_periodic is not None:
            _write_periodic(fh, mesh.gmsh_periodic)
        for name, dat in mesh.point_data.items():
            _write_data(fh, "NodeData", name, dat, write_binary)
        cell_data_raw = raw_from_cell_data(other_data)
        for name, dat in cell_data_raw.items():
            _write_data(fh, "ElementData", name, dat, write_binary)

    return
1307947
public void dumpTo(Page page, PrintWriter out)
    {
        if (produceHeader)
        {
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>");
            out.println("<title>" + page.getTitle() + "</title>");
            out.println("<meta charset=\"utf-8\">");
            out.println("<meta name=\"generator\" content=\"FITLayout - box tree dump\">");
            out.println("</head>");
            out.println("<body>");
        }
        recursiveDumpBoxes(page.getRoot(), 1, out);
        if (produceHeader)
        {
            out.println("</body>");
            out.println("</html>");
        }
    }
55277
public static void resize(GVRMesh mesh, float size) {
        float dim[] = getBoundingSize(mesh);
        float maxsize = 0.0f;

        if (dim[0] > maxsize) maxsize = dim[0];
        if (dim[1] > maxsize) maxsize = dim[1];
        if (dim[2] > maxsize) maxsize = dim[2];

        scale(mesh, size / maxsize);
    }