Skip to content
Snippets Groups Projects
Commit 71c51542 authored by wieners's avatar wieners
Browse files

plotproc wieder eingefuert

mit der $s Option kann nun ein SymbolName an die preprocess Funktion
uebergeben werden
Bitte fuegt hier Plot Funktionen hinzu, die nur die Standard shapefunctions
aus shape.c verwenden.

[[Imported from SVN: r1243]]
parent ad57bab2
No related branches found
No related tags found
No related merge requests found
......@@ -6,12 +6,10 @@
# #
##############################################################################
# include configuration and all makefile macro definitions
include ../../ug.conf
OBJECTS = wpm.o graph.o wop.o initgraph.o
OBJECTS = wpm.o graph.o wop.o initgraph.o plotproc.o
# local C compiler flags
LCFLAGS = -I../../include
......
......@@ -11,7 +11,7 @@
/* Universitaet Stuttgart */
/* Pfaffenwaldring 27 */
/* 70569 Stuttgart */
/* email: ug@ica3.uni-stuttgart.de */
/* email: ug@ica3.uni-stuttgart.de */
/* */
/* History: 27.02.95 begin, ug version 3.0 */
/* */
......@@ -39,6 +39,7 @@
/* graph module */
#include "wpm.h"
#include "wop.h"
#include "plotproc.h"
/* own header */
#include "initgraph.h"
......@@ -53,7 +54,7 @@
RCSID("$Header$",UG_RCS_STRING)
/****************************************************************************/
/*D
/*
InitGraph - Call the inits for the graph module
SYNOPSIS:
......@@ -68,8 +69,8 @@ RCSID("$Header$",UG_RCS_STRING)
RETURN VALUE:
INT
.n 0 if ok
.n 1 if some error occured.
D*/
.n __LINE__ if some error occured.
*/
/****************************************************************************/
INT InitGraph ()
......@@ -90,5 +91,12 @@ INT InitGraph ()
return (err);
}
/* init plotproc.c */
if ((err=InitPlotProc())!=0)
{
SetHiWrd(err,__LINE__);
return (err);
}
return (0);
}
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
/****************************************************************************/
/* */
/* File: plotproc.c */
/* */
/* Purpose: generic plot functions for node vectors */
/* */
/* */
/* Author: Christian Wieners */
/* Institut fuer Computeranwendungen III */
/* Universitaet Stuttgart */
/* Pfaffenwaldring 27 */
/* 70569 Stuttgart */
/* email: ug@ica3.uni-stuttgart.de */
/* */
/* History: November 23, 1996 */
/* */
/* Remarks: */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* include files */
/* system include files */
/* application include files */
/* */
/****************************************************************************/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "general.h"
#include "gm.h"
#include "ugenv.h"
#include "evm.h"
#include "devices.h"
#include "shapes.h"
#include "num.h"
/****************************************************************************/
/* */
/* defines in the following order */
/* */
/* compile time constants defining static data size (i.e. arrays) */
/* other constants */
/* macros */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* data structures used in this source file (exported data structures are */
/* in the corresponding include file!) */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* definition of exported global variables */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* definition of variables global to this source file only (static!) */
/* */
/****************************************************************************/
static INT nodecomp;
/* RCS string */
RCSID("$Header$",UG_RCS_STRING)
/****************************************************************************/
/* */
/* forward declarations of functions used before they are defined */
/* */
/****************************************************************************/
/**************************************************************************/
/*
NodeValue - generic plot funtion
SYNOPSIS:
static DOUBLE NodeValue (const ELEMENT *theElement,
const COORD **CornersCoord, COORD *LocalCoord);
PARAMETERS:
. theElement - pointer to an element
. CornersCoord - corner coordinates
. LocalCoord - local coordinate
DESCRIPTION:
This function plots the values of a node vector, interpolated by the
standard shape functions.
RETURN VALUE:
DOUBLE value
*/
/*************************************************************************/
static INT PreprocessNodeValue (const char *name, MULTIGRID *theMG)
{
VECDATA_DESC *theVD;
theVD = GetVecDataDescByName(theMG,(char *)name);
if (theVD == NULL)
return (1);
if (VD_NCMPS_IN_TYPE(theVD,NODEVECTOR)<1)
return (1);
nodecomp = VD_CMP_OF_TYPE(theVD,NODEVECTOR,0);
return (0);
}
static DOUBLE NodeValue (const ELEMENT *theElement,
const COORD **CornersCoord, COORD *LocalCoord)
{
INT i,n;
DOUBLE phi;
n = CORNERS_OF_ELEM(theElement);
phi = 0.0;
for (i=0; i<n; i++)
phi += GN(n,i,LocalCoord)*VVALUE(NVECTOR(CORNER(theElement,i)),nodecomp);
return(phi);
}
/**************************************************************************/
/*
NodeVector - plots the vector of node values
SYNOPSIS:
static void NodeVector (const ELEMENT *theElement,
const COORD **theCorners, COORD *LocalCoord, DOUBLE *values);
PARAMETERS:
. theElement - pointer to an element
. CornersCoord - corner coordinates
. LocalCoord - local coordinate
. values - plot vector
DESCRIPTION:
This function plots the vector of node values.
RETURN VALUE:
void
*/
/*************************************************************************/
static INT PreprocessNodeVector (const char *name, MULTIGRID *theMG)
{
VECDATA_DESC *theVD;
INT i;
theVD = GetVecDataDescByName(theMG,(char *)name);
if (theVD == NULL)
return (1);
if (VD_NCMPS_IN_TYPE(theVD,NODEVECTOR)<DIM)
return (1);
nodecomp = VD_CMP_OF_TYPE(theVD,NODEVECTOR,0);
for (i=1; i<DIM; i++)
if ((nodecomp+i) != VD_CMP_OF_TYPE(theVD,NODEVECTOR,i))
return (1);
return (0);
}
static void NodeVector (const ELEMENT *theElement, const COORD **theCorners,
COORD *LocalCoord, DOUBLE *values)
{
VECTOR *v;
INT i,j,n;
DOUBLE s;
n = CORNERS_OF_ELEM(theElement);
V_DIM_CLEAR(values);
for (i=0; i<n; i++)
{
v = NVECTOR(CORNER(theElement,i));
s = GN(n,i,LocalCoord);
for (j=0; j<DIM; j++)
values[i] += s*VVALUE(v,nodecomp+i);
}
return;
}
/****************************************************************************/
/*
InitPlotProc - Init this file
SYNOPSIS:
INT InitPlotProc ();
PARAMETERS:
. void -
DESCRIPTION:
This function inits this file.
RETURN VALUE:
INT
.n 0 if ok
.n 1 if error occured.
*/
/****************************************************************************/
INT InitPlotProc ()
{
/* install general plot procs */
if (CreateElementValueEvalProc("nvalue",PreprocessNodeValue,
NodeValue)==NULL)
return(1);
if (CreateElementVectorEvalProc("nvector",PreprocessNodeVector,
NodeVector,DIM)==NULL)
return(1);
return (0);
}
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
/****************************************************************************/
/* */
/* File: plotproc.h */
/* */
/* Purpose: header for generic plot functions */
/* */
/* Author: Christian Wieners */
/* Institut fuer Computeranwendungen III */
/* Universitaet Stuttgart */
/* Pfaffenwaldring 27 */
/* 70569 Stuttgart */
/* email: ug@ica3.uni-stuttgart.de */
/* */
/* History: November 23, 1996 */
/* */
/* Remarks: */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* auto include mechanism and other include files */
/* */
/****************************************************************************/
#ifndef __PLOTPROC__
#define __PLOTPROC__
#include "compiler.h"
/****************************************************************************/
/* */
/* defines in the following order */
/* */
/* compile time constants defining static data size (i.e. arrays) */
/* other constants */
/* macros */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* data structures exported by the corresponding source file */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* definition of exported global variables */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* function declarations */
/* */
/****************************************************************************/
INT InitPlotProc (void);
#endif
......@@ -3250,7 +3250,8 @@ static INT InitScalarFieldPlotObject_2D (PLOTOBJ *thePlotObj, INT argc, char **a
break;
if (strlen(buffer)>=NAMESIZE) break;
strcpy(PO_NAME(theEspo),buffer);
theEspo->EvalFct = GetElementValueEvalProc("nvalue");
if (theEspo->EvalFct == NULL)
theEspo->EvalFct = GetElementValueEvalProc("nvalue");
break;
}
......@@ -3467,7 +3468,8 @@ static INT InitVectorFieldPlotObject_2D (PLOTOBJ *thePlotObj, INT argc, char **a
break;
if (strlen(buffer)>=NAMESIZE) break;
strcpy(PO_NAME(theEvpo),buffer);
theEvpo->EvalFct = GetElementVectorEvalProc("nvector");
if (theEvpo->EvalFct == NULL)
theEvpo->EvalFct = GetElementVectorEvalProc("nvector");
break;
}
......@@ -4138,7 +4140,8 @@ static INT InitScalarFieldPlotObject_3D (PLOTOBJ *thePlotObj, INT argc, char **a
break;
if (strlen(buffer)>=NAMESIZE) break;
strcpy(PO_NAME(theEspo),buffer);
theEspo->EvalFct = GetElementValueEvalProc("nvalue");
if (theEspo->EvalFct == NULL)
theEspo->EvalFct = GetElementValueEvalProc("nvalue");
break;
}
......@@ -4351,7 +4354,8 @@ static INT InitVectorFieldPlotObject_3D (PLOTOBJ *thePlotObj, INT argc, char **a
break;
if (strlen(buffer)>=NAMESIZE) break;
strcpy(PO_NAME(theEvpo),buffer);
theEvpo->EvalFct = GetElementVectorEvalProc("nvector");
if (theEvpo->EvalFct == NULL)
theEvpo->EvalFct = GetElementVectorEvalProc("nvector");
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment