当前位置: 首页>>代码示例>>C++>>正文


C++ List::Check_List方法代码示例

本文整理汇总了C++中List::Check_List方法的典型用法代码示例。如果您正苦于以下问题:C++ List::Check_List方法的具体用法?C++ List::Check_List怎么用?C++ List::Check_List使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在List的用法示例。


在下文中一共展示了List::Check_List方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: error

// *****************************************************************************
// *****************************************************************************
void Euler2D_Mesh::SLK_MeshWriter(const char* FileName) {
    int i, j, n1, n2, NQuad = 0;
    FILE *fp;

    // Open file for write
    if ((fp = fopen(FileName, "w")) == 0)
        error("SLK_MeshWriter: %s %s\n", "Couldn't Open Optimized Mesh File:", FileName);

#ifdef VERBOSE
    info("Writing Optimized Mesh File: %s", FileName);
#endif

    // Write out nodes
    fprintf(fp, "# Number of grid points\n");
    fprintf(fp, "%d\n", mesh.nnodes);
    for (i = 0; i < mesh.nnodes; i++)
        fprintf(fp, "%22.15e %22.15e\n", node[i].x, node[i].y);

    fprintf(fp, "# Number of blocks\n");
    fprintf(fp, "1\n");

    fprintf(fp, "# Number of triangular elements\n");
    fprintf(fp, "%d\n", mesh.inside);
    for (i = 0; i < mesh.inside; i++)
        fprintf(fp, "%d %d %d\n", cell[i].node1+1, cell[i].node2+1, cell[i].node3+1);

    fprintf(fp, "# Number of quadrilateral elements\n");
    fprintf(fp, "%d\n", NQuad);

    // Get the Number of Boundaries
    List bndy;
    for (i = 0; i < mesh.nbedges; i++)
        bndy.Check_List(boundaryEdge[i].bcType);

    fprintf(fp, "# Number of boundaries\n");
    fprintf(fp, "%d\n", bndy.max);

    if (bndy.max > 0) {
        int *nbs = NULL;
        nbs = (int*) malloc(bndy.max*sizeof(int));
        for (i = 0; i < bndy.max; i++)
            nbs[i] = 0;

        for (i = 0; i < mesh.nbedges; i++)
            nbs[bndy.Index(boundaryEdge[i].bcType)]++;
        
        for (i = 0; i < bndy.max; i++) {
            fprintf(fp, "# Number of edges for boundary %d\n", i + 1);
            fprintf(fp, "%d\n", nbs[i]);
            for (j = 0; j < mesh.nbedges; j++) {
                if (bndy.list[i] == boundaryEdge[j].bcType) {
                    n1 = edge[boundaryEdge[j].edgeNumber].node1;
                    n2 = edge[boundaryEdge[j].edgeNumber].node2;
                    fprintf(fp, "%d %d\n", n1+1, n2+1);
                }
            }
        }
    }

    // Constants
    NQuad = 4;
    fprintf(fp, "# Number of Constants\n");
    fprintf(fp, "%d\n", NQuad);
    fprintf(fp, "0.0\n");
    fprintf(fp, "0.0\n");
    fprintf(fp, "0.0\n");
    fprintf(fp, "1.4\n");
    // Variables
    fprintf(fp, "# Number of Variables\n");
    NQuad = 4;
    fprintf(fp, "%d\n", NQuad);
    fprintf(fp, "density\n");
    fprintf(fp, "x-momentum\n");
    fprintf(fp, "y-momentum\n");
    fprintf(fp, "energy\n");
    for (i = 0; i < mesh.nnodes; i++)
        fprintf(fp, "%22.15e %22.15e %22.15e %22.15e\n",
                node[i].Q[0], node[i].Q[1], node[i].Q[2], node[i].Q[3]);
    
    // Close File
    fclose(fp);

#ifdef VERBOSE
    printf("=============================================================================\n");
#endif
}
开发者ID:ashishgupta02,项目名称:cfdsolutions,代码行数:88,代码来源:Euler2D_Mesh.cpp


注:本文中的List::Check_List方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。