[cig-commits] r7500 - cs/cigma/branches/cigma-0.9/src
luis at geodynamics.org
luis at geodynamics.org
Tue Jun 26 09:43:22 PDT 2007
Author: luis
Date: 2007-06-26 09:43:22 -0700 (Tue, 26 Jun 2007)
New Revision: 7500
Added:
cs/cigma/branches/cigma-0.9/src/array.h
cs/cigma/branches/cigma-0.9/src/attr.h
cs/cigma/branches/cigma-0.9/src/common.h
cs/cigma/branches/cigma-0.9/src/cube.h
cs/cigma/branches/cigma-0.9/src/dataset.h
cs/cigma/branches/cigma-0.9/src/det.h
cs/cigma/branches/cigma-0.9/src/fe.h
cs/cigma/branches/cigma-0.9/src/field.h
cs/cigma/branches/cigma-0.9/src/io.h
cs/cigma/branches/cigma-0.9/src/mesh.h
cs/cigma/branches/cigma-0.9/src/points.h
cs/cigma/branches/cigma-0.9/src/rule.h
cs/cigma/branches/cigma-0.9/src/split.h
Log:
darcs patch: Added header files
Added: cs/cigma/branches/cigma-0.9/src/array.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/array.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/array.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,49 @@
+#ifndef __CIGMA_ARRAY_H__
+#define __CIGMA_ARRAY_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <hdf5.h>
+
+
+
+typedef struct {
+ int rank;
+ hsize_t *shape;
+ hid_t type_id;
+ void *data;
+} array_t;
+
+
+
+int array_init(array_t *array, hid_t type_id, int rank, int *shape, void *data);
+int array_free_dims(array_t *array);
+int array_free_data(array_t *array);
+int array_free(array_t *array);
+
+
+int array_npoints(array_t *array);
+int array_dim(array_t *array, int i);
+void array_dims(array_t *array, int *rank, int **shape);
+void array_dims1(array_t *array, int *n);
+void array_dims2(array_t *array, int *m, int *n);
+void array_dims3(array_t *array, int *l, int *m, int *n);
+
+
+hid_t array_open(array_t *array, hid_t loc_id, const char *name);
+hid_t array_create(array_t *array, hid_t loc_id, const char *name, const char *title);
+
+
+int array_read(array_t *array, hid_t loc_id, const char *name);
+int array_write(array_t *array, hid_t loc_id, const char *name);
+
+
+int array_read_slice(array_t *array, hid_t dataset_id, int start, int end);
+int array_write_slice(array_t *array, hid_t dataset_id, int start, int end);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/attr.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/attr.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/attr.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,45 @@
+#ifndef __CIGMA_ATTR_H__
+#define __CIGMA_ATTR_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <hdf5.h>
+
+
+herr_t find_attr(hid_t loc_id, const char *attr_name);
+herr_t set_attr(hid_t obj_id, const char *attr_name, hid_t type_id, const void *data);
+herr_t get_attr(hid_t obj_id, const char *attr_name, hid_t type_id, void *data);
+herr_t get_attr_dims(hid_t obj_id, const char *attr_name, int *rank, hsize_t *dims);
+
+
+herr_t set_str_attr(hid_t obj_id, const char *attr_name, const char *attr_data);
+herr_t get_str_attr(hid_t obj_id, const char *attr_name, char **data);
+
+
+herr_t set_float_attr(hid_t obj_id, const char *attr_name, float x);
+herr_t set_double_attr(hid_t obj_id, const char *attr_name, double x);
+herr_t set_int_attr(hid_t obj_id, const char *attr_name, int n);
+herr_t set_long_attr(hid_t obj_id, const char *attr_name, long n);
+herr_t set_llong_attr(hid_t obj_id, const char *attr_name, long long n);
+
+
+herr_t set_array_attr(hid_t obj_id, const char *attr_name,
+ size_t rank, hsize_t *dims, hid_t type_id, const void *data);
+
+herr_t set_array1_attr(hid_t obj_id, const char *attr_name,
+ hsize_t dim, hid_t type_id, const void *data);
+
+herr_t set_int_array_attr(hid_t obj_id, const char *attr_name,
+ hsize_t dim, const int *data);
+
+herr_t set_float_array_attr(hid_t obj_id, const char *attr,
+ hsize_t dim, const float *data);
+
+herr_t set_double_array_attr(hid_t obj_id, const char *attr,
+ hsize_t dim, const double *data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/common.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/common.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/common.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,39 @@
+#ifndef __CIGMA_COMMON_H__
+#define __CIGMA_COMMON_H__
+
+/** @{ */
+/**
+ * @file
+ * common symbols for cigma library
+ */
+
+#ifdef __cplusplus
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS }
+#else
+#define __BEGIN_DECLS /* empty */
+#define __END_DECLS /* empty */
+#endif
+
+
+#if defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif /* _GNU_SOURCE */
+#endif /* linux */
+
+
+#ifdef _WINDOWS
+
+#ifdef CIGMA_EXPORTS
+#define CIGMA_DLL __declspec(dllexport)
+#else
+#define CIGMA_DLL __declspec(dllimport)
+#endif
+#else /* _WINDOWS */
+#define CIGMA_DLL
+#endif /* _WINDOWS */
+
+
+/** @} */
+#endif
Added: cs/cigma/branches/cigma-0.9/src/cube.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/cube.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/cube.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,28 @@
+#ifndef __CIGMA_CUBE_H__
+#define __CIGMA_CUBE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ int L, M, N;
+ int nno;
+ int hexnel;
+ int tetnel;
+ double *coords;
+ int *hexconn;
+ int *tetconn;
+} cube_t;
+
+
+void cube_init(cube_t *cube);
+void cube_free(cube_t *cube);
+
+int cube_partition(cube_t *cube, int L, int M, int N);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/dataset.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/dataset.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/dataset.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,79 @@
+#ifndef __CIGMA_DATASET_H__
+#define __CIGMA_DATASET_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <hdf5.h>
+
+
+hid_t dataset_create(hid_t loc_id, const char *name, const char *title,
+ hid_t type_id, int rank, int *shape);
+
+hid_t dataset_open(hid_t loc_id, const char *name,
+ hid_t *type_id, int *rank, int *shape,
+ int *npoints);
+
+
+int dataset_read(hid_t loc_id, const char *name,
+ hid_t type_id, int rank, int *shape,
+ void **data);
+
+
+int dataset_write(hid_t loc_id, const char *name, const char *title,
+ hid_t type_id, int rank, int *shape,
+ void *data);
+
+
+int dataset_read1(hid_t loc_id,
+ const char *name,
+ hid_t type_id,
+ void **data, int *n);
+
+int dataset_read2(hid_t loc_id,
+ const char *name,
+ hid_t type_id,
+ void **data, int *m, int *n);
+
+int dataset_read3(hid_t loc_id,
+ const char *name,
+ hid_t type_id,
+ void **data, int *l, int *m, int *n);
+
+
+int dataset_write1(hid_t loc_id,
+ const char *name,
+ const char *title,
+ hid_t type_id,
+ void *data, int n);
+
+int dataset_write2(hid_t loc_id,
+ const char *name,
+ const char *title,
+ hid_t type_id,
+ void *data, int m, int n);
+
+int dataset_write3(hid_t loc_id,
+ const char *name,
+ const char *title,
+ hid_t type_id,
+ void *data, int l, int m, int n);
+
+
+int dataset_read3_slice(hid_t loc_id,
+ const char *name,
+ hid_t type_id,
+ int rank, hsize_t *dims, void *data,
+ int start, int end);
+
+int dataset_write3_slice(hid_t loc_id,
+ const char *name,
+ const char *title,
+ hid_t type_id,
+ int start, int end);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/det.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/det.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/det.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,13 @@
+#ifndef __CIGMA_DET_H__
+#define __CIGMA_DET_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double det3x3(double *m);
+double det4x4(double *m);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/fe.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/fe.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/fe.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,32 @@
+#ifndef __CIGMA_FE_H__
+#define __CIGMA_FE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+typedef double (*shape_fn)(double *xi);
+typedef void (*tabulator_fn)(double *xi, double *N);
+
+
+typedef struct {
+ int nsd; /* number of spatial dimensions (1d, 2d, 3d) */
+ int ndim; /* number of components (scalar, vector, tensor) */
+ int ndof; /* number of degrees of freedom */
+ shape_fn *N; /* array of basis functions */
+ shape_fn *dN; /* [nsd x ndof] matrix of derivatives */
+} fe_t;
+
+
+
+void fe_jacobian(fe_t *fe, double *x, double xi[3], double J[3*3]);
+void fe_tabulate(fe_t *fe, double *xs, int npts, double *tab);
+void fe_eval(fe_t *fe, double *dof, double *xi, double *val);
+void fe_batch_eval(fe_t *fe, double *dof, double *tab, int npts, double *vals);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/field.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/field.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/field.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,45 @@
+#ifndef __CIGMA_FIELD_H__
+#define __CIGMA_FIELD_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hdf5.h"
+#include "fe.h"
+#include "mesh.h"
+
+
+
+typedef int (*extern_field)(int npts, double *x, int nsd, double *y, int dims);
+
+
+
+typedef struct {
+ int nno; // number of nodes
+ int ndim; // number of components in field: scalar=1 vector=2,3 tensor=6
+ mesh_t *mesh; // pointer to parent mesh object
+ extern_field eval; // function pointer for externally defined fields
+ fe_t *fe; // finite element space -- metadata for interpreting dof[]
+ double *dofs; // [nno x ndim] matrix
+} field_t;
+
+
+
+void field_dofs(field_t *field, int e, double *dof);
+void field_eval(field_t *B, double *x, int nq, double *g, int dims);
+
+
+int field_init(field_t *field, mesh_t *mesh);
+int field_init2(field_t *field, mesh_t *mesh, int nno, int ndim, double *dofs);
+int field_free(field_t *field);
+
+
+int field_open(field_t *field, const char *filename, const char *path);
+int field_read(field_t *field, hid_t loc_id, const char *name);
+int field_write(field_t *field, hid_t loc_id, const char *name, const char *title);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/io.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/io.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/io.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,24 @@
+#ifndef __CIGMA_IO_H__
+#define __CIGMA_IO_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <hdf5.h>
+
+
+hid_t file_create(const char *filename, const char *mode);
+hid_t file_open(const char *filename, const char *mode);
+
+
+hid_t group_create(hid_t loc_id, const char *name);
+hid_t group_open(hid_t loc_id, const char *name);
+
+
+hid_t touch_group(hid_t loc_id, const char *name);
+hid_t touch_path(hid_t loc_id, const char *path);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/mesh.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/mesh.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/mesh.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,41 @@
+#ifndef __CIGMA_MESH_H__
+#define __CIGMA_MESH_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <hdf5.h>
+
+
+
+typedef struct {
+ int nno; // number of nodes
+ int nsd; // number of spatial dimensions
+ int nel; // number of elements
+ int ndof; // number of degrees of freedom per element
+ double *coords; // node coordinates
+ int *connect; // element connectivity
+} mesh_t;
+
+
+
+int mesh_init_coords(mesh_t *m, int nno, int nsd);
+int mesh_init_connect(mesh_t *m, int nel, int ndof);
+int mesh_free(mesh_t *m);
+
+
+int mesh_open(mesh_t *m, const char *filename, const char *path);
+int mesh_open2(mesh_t *m, const char *filename, const char *coords_path, const char *connect_path);
+
+
+int mesh_read_coords(mesh_t *m, hid_t loc_id, const char *coords_path);
+int mesh_read_connect(mesh_t *m, hid_t loc_id, const char *connect_path);
+
+
+void mesh_coords(mesh_t *m, int e, double *dof_coords);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/points.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/points.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/points.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,47 @@
+#ifndef __CIGMA_POINTS_H__
+#define __CIGMA_POINTS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <hdf5.h>
+
+
+
+typedef struct {
+ int nel; // total number of elements
+ int npts; // total number of points per element
+ int ndim; // number of dimensions (or components)
+ int start,end; // dataset view parameters
+ hid_t dset; // dataset
+ double *x; // [nel x npts x nsd] matrix -- point data
+} points_t;
+
+
+
+int points_init(points_t *points, int nel, int npts, int ndim, double *x);
+int points_free_dset(points_t *points);
+int points_free_data(points_t *points);
+int points_free(points_t *points);
+
+
+int points_open(points_t *points, const char *filename, const char *path);
+int points_create(points_t *points, const char *filename, const char *path, const char *title);
+
+
+int points_open_dset(points_t *points, hid_t loc_id, const char *name);
+int points_create_dset(points_t *points, hid_t loc_id, const char *name, const char *title);
+
+
+int points_read(points_t *points);
+int points_write(points_t *points);
+
+
+int points_read_slice(points_t *points, int start, int end);
+int points_write_slice(points_t *points, int start, int end);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/rule.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/rule.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/rule.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,42 @@
+#ifndef __CIGMA_RULE_H__
+#define __CIGMA_RULE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <hdf5.h>
+
+
+
+typedef struct {
+ int nq; /* number of quadrature points */
+ int nsd; /* number of spatial dimensions */
+ double *weights; /* quadrature weights */
+ double *points; /* quadrature points */
+} rule_t;
+
+
+
+int rule_init(rule_t *qr, int nq, int nsd);
+int rule_free(rule_t *qr);
+
+
+int rule_open(rule_t *qr, const char *filename, const char *path);
+int rule_open_txt(rule_t *qr, const char *filename);
+
+
+int rule_create(rule_t *qr, const char *filename, const char *path);
+int rule_create_txt(rule_t *qr, const char *filename);
+
+int rule_read(rule_t *qr, hid_t loc_id);
+int rule_write(rule_t *qr, hid_t loc_id);
+
+
+int rule_read2(rule_t *qr, hid_t loc_id, const char *weights_path, const char *points_path);
+int rule_write2(rule_t *qr, hid_t loc_id, const char *weights_path, const char *points_path);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: cs/cigma/branches/cigma-0.9/src/split.h
===================================================================
--- cs/cigma/branches/cigma-0.9/src/split.h 2007-06-26 16:42:39 UTC (rev 7499)
+++ cs/cigma/branches/cigma-0.9/src/split.h 2007-06-26 16:43:22 UTC (rev 7500)
@@ -0,0 +1,16 @@
+#ifndef __UTIL_SPLIT_H__
+#define __UTIL_SPLIT_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void split(const char *str, int len,
+ char ***split_list, int *split_count,
+ char sep);
+
+void split_free(char **split_list, int split_count);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
More information about the cig-commits
mailing list