ESYS13  Revision_
ElementFile.h
Go to the documentation of this file.
00001 
00002 /*******************************************************
00003 *
00004 * Copyright (c) 2003-2012 by University of Queensland
00005 * Earth Systems Science Computational Center (ESSCC)
00006 * http://www.uq.edu.au/esscc
00007 *
00008 * Primary Business: Queensland, Australia
00009 * Licensed under the Open Software License version 3.0
00010 * http://www.opensource.org/licenses/osl-3.0.php
00011 *
00012 *******************************************************/
00013 
00014 #ifndef INC_DUDLEY_ELEMENTFILE
00015 #define INC_DUDLEY_ELEMENTFILE
00016 
00017 #include "Dudley.h"
00018 #include "NodeFile.h"
00019 #include "ElementType.h"
00020 #include "escript/DataC.h"
00021 
00022 #ifdef ESYS_MPI
00023 #include "esysUtils/Esys_MPI.h"
00024 #endif
00025 
00026 typedef struct {
00027     Dudley_Status_t status; /* status of mesh when jacobeans where updated last time */
00028     dim_t numDim;       /* spatial dimension */
00029     dim_t numQuad;      /* number of quadrature nodes used to calculate jacobeans */
00030     dim_t numShapes;        /* number of shape functions */
00031     dim_t numElements;      /* number of elements */
00032     double *absD;       /* used to compute volume */
00033     double quadweight;      /* used to compute volume */
00034     double *DSDX;       /* derivatives of shape functions in global coordinates at quadrature points */
00035 } Dudley_ElementFile_Jacobeans;
00036 
00037 struct Dudley_ElementFile {
00038     Esys_MPIInfo *MPIInfo;
00039     Esys_MPI_rank *Owner;
00040 
00041     dim_t numElements;      /* number of elements. */
00042 
00043     index_t *Id;        /* Id[i] is the id nmber of
00044                    node i. this number is not
00045                    used but useful when
00046                    elements are resorted. in
00047                    the entire code the term
00048                    'element id' refers to i
00049                    but nor to Id[i] if not
00050                    explicitly stated
00051                    otherwise. */
00052 
00053     index_t *Tag;       /* Tag[i] is the tag of element i. */
00054 
00055     index_t *tagsInUse;     /* array of tags which are actually used */
00056     dim_t numTagsInUse;     /* number of tags used */
00057 
00058     dim_t numNodes;     /* number of nodes per element */
00059     index_t *Nodes;     /* Nodes[INDEX(k, i, numNodes)]
00060                    is the k-the node in the
00061                    i-the element. note that
00062                    in the way the nodes are
00063                    ordered Nodes[INDEX(k, i, numNodes)
00064                    is k-the node of element i
00065                    when refering to the
00066                    linear version of the
00067                    mesh. */
00068     index_t minColor;       /* minimum color */
00069     index_t maxColor;       /* maximum color */
00070     index_t *Color;     /* assigns each element a color. elements with the same color     
00071                    are don't share a node so they can be processed simultaneously 
00072                    at anytime Color must provide a valid value. In any case one can set  
00073                    Color[e]=e  for all e */
00074 
00075     Dudley_ElementFile_Jacobeans *jacobeans;    /* jacobeans of the shape function used for solution approximation */
00076     Dudley_ElementFile_Jacobeans *jacobeans_reducedQ;   /* jacobeans of the shape function used for solution approximation for reduced integration order */
00077     dim_t numDim;       /* spatial dimension of the domain */
00078     dim_t numLocalDim;      /* dimension of the element eg 2 for A line in 2D or 3D */
00079     Dudley_ElementTypeId etype; /* element type */
00080     const char *ename;      /* name of element type */
00081     dim_t numShapes;        /* number of shape functions */
00082 };
00083 
00084 typedef struct Dudley_ElementFile Dudley_ElementFile;
00085 Dudley_ElementFile *Dudley_ElementFile_alloc(Dudley_ElementTypeId etype, Esys_MPIInfo * MPIInfo);
00086 void Dudley_ElementFile_free(Dudley_ElementFile *);
00087 void Dudley_ElementFile_allocTable(Dudley_ElementFile *, dim_t);
00088 void Dudley_ElementFile_freeTable(Dudley_ElementFile *);
00089 void Dudley_ElementFile_setElementDistribution(Dudley_ElementFile * in, dim_t * distribution);
00090 dim_t Dudley_ElementFile_getGlobalNumElements(Dudley_ElementFile * in);
00091 dim_t Dudley_ElementFile_getMyNumElements(Dudley_ElementFile * in);
00092 index_t Dudley_ElementFile_getFirstElement(Dudley_ElementFile * in);
00093 void Dudley_ElementFile_distributeByRankOfDOF(Dudley_ElementFile * self, Esys_MPI_rank * mpiRankOfDOF, index_t * Id);
00094 
00095 void Dudley_ElementFile_createColoring(Dudley_ElementFile * in, dim_t numNodes, dim_t * degreeOfFreedom);
00096 void Dudley_ElementFile_optimizeOrdering(Dudley_ElementFile ** in);
00097 void Dudley_ElementFile_setNodeRange(dim_t *, dim_t *, Dudley_ElementFile *);
00098 void Dudley_ElementFile_relableNodes(dim_t *, dim_t, Dudley_ElementFile *);
00099 void Dudley_ElementFile_markNodes(dim_t *, dim_t, dim_t, Dudley_ElementFile *, dim_t);
00100 void Dudley_ElementFile_scatter(dim_t *, Dudley_ElementFile *, Dudley_ElementFile *);
00101 void Dudley_ElementFile_gather(dim_t *, Dudley_ElementFile *, Dudley_ElementFile *);
00102 void Dudley_ElementFile_copyTable(dim_t, Dudley_ElementFile *, dim_t, dim_t, Dudley_ElementFile *);
00103 void Dudley_ElementFile_markDOFsConnectedToRange(index_t * mask, index_t offset, index_t marker, index_t firstDOF,
00104                          index_t lastDOF, index_t * dofIndex, Dudley_ElementFile * in,
00105                          bool_t useLinear);
00106 
00107 void Dudley_ElementFile_setTags(Dudley_ElementFile *, const int, escriptDataC *);
00108 Dudley_ElementFile_Jacobeans *Dudley_ElementFile_Jacobeans_alloc(void);
00109 void Dudley_ElementFile_Jacobeans_dealloc(Dudley_ElementFile_Jacobeans *);
00110 Dudley_ElementFile_Jacobeans *Dudley_ElementFile_borrowJacobeans(Dudley_ElementFile *, Dudley_NodeFile *, bool_t);
00111 void Dudley_ElementFile_setTagsInUse(Dudley_ElementFile * in);
00112 
00113 #endif              /* #ifndef INC_DUDLEY_ELEMENTFILE */