コード例 #1
0
ファイル: Partition.c プロジェクト: gilles-didier/MolTi
TypePartitionCompact *getPartitionCompact(TypePartition *part) {
    int a, ind=0;
    TypePartitionList *pl = getPartitionList(part);
    TypePartitionCompact *pc = (TypePartitionCompact *) malloc(sizeof(TypePartitionCompact));
    pc->sizeAtom = part->sizeAtom;
    pc->start = (int*) malloc((pc->sizeAtom+1)*sizeof(int));
    pc->item = (int*) malloc((part->sizeItem)*sizeof(int));
    ind = 0;
    for(a=0; a<pc->sizeAtom; a++) {
        int i;
        pc->start[a] = ind;
        for(i=pl->start[a]; i!=-1; i=pl->next[i])
            pc->item[ind++] = i;
    }
    pc->start[a] = ind;
    freePartitionList(pl);
    return pc;
}
コード例 #2
0
ファイル: Partition.c プロジェクト: gilles-didier/MolTi
/*print partition*/
void fprintPartitionStandard(FILE *f, TypePartition *part, char **name) {
    TypePartitionList *pl = getPartitionList(part);
    if(name) {
        int c,i;
        for(c=0; c<pl->sizeAtom; c++) {
            for(i=pl->start[c]; i>=0; i=pl->next[i])
                fprintf(f, "%s\t", name[i]);
            fprintf(f, "\n");
        }
    } else {
        int c,i;
        for(c=0; c<pl->sizeAtom; c++) {
            for(i=pl->start[c]; i>=0; i=pl->next[i])
                fprintf(f, "%d\t", i+1);
            fprintf(f, "\n");
        }
    }
    freePartitionList(pl);
}
コード例 #3
0
ファイル: Partition.c プロジェクト: gilles-didier/MolTi
/*print partition*/
void fprintPartitionClustNSee(FILE *f, TypePartition *part, char **name) {
    TypePartitionList *pl = getPartitionList(part);
    fprintf(f, "#ClustnSee analysis export\n");
    if(name) {
        int c,i;
        for(c=0; c<pl->sizeAtom; c++) {
            fprintf(f, "ClusterID:%d||\n", c+1);
            for(i=pl->start[c]; i>=0; i=pl->next[i])
                fprintf(f, "%s\n", name[i]);
            fprintf(f, "\n");
        }
    } else {
        int c,i;
        for(c=0; c<pl->sizeAtom; c++) {
            fprintf(f, "ClusterID:%d||\n", c+1);
            for(i=pl->start[c]; i>=0; i=pl->next[i])
                fprintf(f, "%d\n", i+1);
            fprintf(f, "\n");
        }
    }
    freePartitionList(pl);
}
コード例 #4
0
BOOL makePartitionTable(struct HDTBPartition *table, ULONG type)
{
    D(bug("[HDToolBox] makePartitionTable()\n"));

    if (table->table)
    {
        /* if there is already a partition table then free it */
        freePartitionList(&table->listnode.list);
        DestroyPartitionTable(table->ph);
    }
    else
    {
        table->table = AllocMem(sizeof(struct PartitionTable), MEMF_PUBLIC | MEMF_CLEAR);
    }
    if (table->table)
    {
        if (CreatePartitionTable(table->ph, type) == 0)
        {
            getPartitionInfo(table->table, table->ph);
            return TRUE;
        }
    }
    return FALSE;
};