예제 #1
0
void glfemPlotDiscField(femMesh *theMesh, double (*f)(int,double,double,double,double),double fMin, double fMax,int level)
{
    int i,j,*nodes;
    double x[3],y[3];
	double xsi[3] = {0.0,1.0,0.0};
    double eta[3] = {0.0,0.0,1.0};
    
    for (i = 0; i < theMesh->nElem; ++i) {
        nodes = femMeshElem(theMesh,i);
        for (j=0; j < 3; ++j) {
            x[j] = theMesh->X[nodes[j]-1];
            y[j] = theMesh->Y[nodes[j]-1]; }              
        glfemDrawColorRecursiveTriangle(x,y,xsi,eta,f,fMin,fMax,i,level); }
    glColor3f(0.0, 0.0, 0.0);
    glfemPlotMesh(theMesh);
}
예제 #2
0
void glfemPlotField(femMesh *theMesh, double *u)
{
    int i,j,*nodes;
    float coord[6];
    double uLoc[3];
    double uMax = femMax(u,theMesh->nNode);
    double uMin = femMin(u,theMesh->nNode);
    
    for (i = 0; i < theMesh->nElem; ++i) {
        nodes = femMeshElem(theMesh,i);
        for (j=0; j < 3; ++j) {
            coord[j*2+0] = theMesh->X[nodes[j]-1];
            coord[j*2+1] = theMesh->Y[nodes[j]-1];
            uLoc[j] = scale(uMin,uMax,u[nodes[j]-1]); 
		}              
        glfemDrawColorTriangle(coord,uLoc); }
    glColor3f(0.0, 0.0, 0.0);
    glfemPlotMesh(theMesh);
}
예제 #3
0
void glfemPlotField(femMesh *theMesh, double *u)
{
    int i,j,*nodes;
    float  xLoc[4];
    float  yLoc[4];
    double uLoc[4];
    double uMax = femMax(u,theMesh->nNode);
    double uMin = femMin(u,theMesh->nNode);
    int nLocalNode = theMesh->nLocalNode;
    
    for (i = 0; i < theMesh->nElem; ++i) {
        nodes = &(theMesh->elem[i*nLocalNode]);
        for (j=0; j < nLocalNode; ++j) {
            xLoc[j] = theMesh->X[nodes[j]];
            yLoc[j] = theMesh->Y[nodes[j]];
            uLoc[j] = glScale(uMin,uMax,u[nodes[j]]); }              
        glfemDrawColorElement(xLoc,yLoc,uLoc,nLocalNode); }
    glColor3f(0.0, 0.0, 0.0);
    glfemPlotMesh(theMesh);
}