MACSio  0.9
Multi-purpose, Application-Centric, Scalable I/O Proxy App
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
foo.c
Go to the documentation of this file.
1 /* There are a lot of variables we could define. Its too much to put each one on
2  a command-line to macsio's main. We would wind up putting this infromation in
3  some file that we pass to macsio's main anyways. Here are some options...
4 
5  1. Define a large set of *possible* mesh variables and then just pass a check-box
6  table indicating which variables to include in output.
7 
8  2. Write C code for the variables that we define and the compile into MACSio like
9  we do static plugins.
10 
11  3. Same as 2 except handle as dlopen-based plugin. Could have several different
12  sets of variables and command-line argument just picks a set.
13 
14  Note that from an I/O run perspective, biggest issue is just their number, not
15  their particular content. Compression, materials, centering/order, etc. become
16  relevant when stressing a given plugin's features.
17 
18  Evolving variable contents from time-step to time-step may be a useful way to
19  then also drive communication and compute loads in a way that are somewhat
20  representative of real applications.
21 
22  One thing is to 'paint' a variable onto a mesh. Another one is to evolve a
23  variable to the next timestep. Think of a single cycle of a sin wave stretched
24  across the domain. Evolving that might be just varying its amplitude as a
25  function of time; a(t)*sin(x) for example. Maybe a(t) = a0t+t0 would be a
26  linear increase in amplitude with time. Maybe we let a(t)=sin(t) so that
27  amplitude goes up and down with time, etc.
28 
29  All we really need to do is to make it easy to create really interesting
30  functions in C code which we can then evaluate easily from within MACSio
31  as we evolve in time.
32 
33 */
34 
35 macsio_eval_state_t
36 normal_vector(int ncoords, double const *coords, double *results)
37 {
38  double x = ncoords >=1 ? coords[0] : 0.0;
39  double y = ncoords >=2 ? coords[1] : 0.0;
40  double z = ncoords >=3 ? coords[2] : 0.0;
41  double mag = sqrt(x*x+y*y+z*z);
42  double xhat = x/mag;
43  double yhat = y/mag;
44  double zhat = z/mag;
45  if (ncoords >= 1) results[0] = xhat;
46  if (ncoords >= 2) results[1] = yhat;
47  if (ncoords >= 3) results[2] = zhat;
48  return MACSIO_EVAL_OK;
49 }
macsio_eval_state_t normal_vector(int ncoords, double const *coords, double *results)
Definition: foo.c:36