1 2 #define PETSCDM_DLL 3 #include <petsc/private/dmswarmimpl.h> /*I "petscdmswarm.h" I*/ 4 5 //typedef PetscErrorCode (*swarm_project)(DM,DM,Vec) DMSwarmProjectMethod; /* swarm, geometry, result */ 6 7 //typedef enum { PROJECT_DMDA_AQ1=0, PROJECT_DMDA_P0 } DMSwarmDMDAProjectionType; 8 9 #if 0 10 PetscErrorCode DMSwarmRegisterPetscDatatypeField(DM dm,const char fieldname[],PetscInt blocksize,PetscDataType type) 11 { 12 13 PetscFunctionReturn(0); 14 } 15 16 PetscErrorCode DMSwarmRegisterUserDatatypeField(DM dm,const char fieldname[],size_t bytes) 17 { 18 19 PetscFunctionReturn(0); 20 } 21 22 PetscErrorCode DMSwarmGetField(DM dm,const char fieldname[],PetscInt *blocksize,PetscDataType *type,void **data) 23 { 24 25 PetscFunctionReturn(0); 26 } 27 28 PetscErrorCode DMSwarmDefineFieldVector(DM dm,const char *fieldnames[]) 29 { 30 /* Check all fields are of type PETSC_REAL or PETSC_SCALAR */ 31 /* Compute summed block size */ 32 /* Set guard */ 33 PetscFunctionReturn(0); 34 } 35 36 PetscErrorCode DMSwarmGetGlobalVectorFromFields(DM dm,Vec *vec) 37 { 38 PetscFunctionReturn(0); 39 } 40 PetscErrorCode DMSwarmRestoreGlobalVectorFromFields(DM dm,Vec *vec) 41 { 42 PetscFunctionReturn(0); 43 } 44 45 /* requires DMSwarmDefineFieldVector has been called */ 46 PetscErrorCode DMCreateGlobalVector_Swarm() 47 { 48 49 PetscFunctionReturn(0); 50 } 51 52 /* requires DMSwarmDefineFieldVector has been called */ 53 PetscErrorCode DMLocalGlobalVector_Swarm() 54 { 55 56 PetscFunctionReturn(); 57 } 58 59 /* Defines what the local space will be */ 60 PetscErrorCode DMSwarmSetOverlap() 61 { 62 63 PetscFunctionReturn(); 64 } 65 66 67 /* coordinates */ 68 /* 69 DMGetCoordinateDM returns self 70 DMGetCoordinates and DMGetCoordinatesLocal return same thing 71 Local view could be used to define overlapping information 72 */ 73 74 #endif 75 76 #undef __FUNCT__ 77 #define __FUNCT__ "DMDestroy_Swarm" 78 PetscErrorCode DMDestroy_Swarm(DM dm) 79 { 80 DM_Swarm *swarm = (DM_Swarm*)dm->data; 81 PetscErrorCode ierr; 82 83 PetscFunctionBegin; 84 ierr = PetscFree(swarm);CHKERRQ(ierr); 85 PetscFunctionReturn(0); 86 } 87 88 #undef __FUNCT__ 89 #define __FUNCT__ "DMCreate_Swarm" 90 PETSC_EXTERN PetscErrorCode DMCreate_Swarm(DM dm) 91 { 92 DM_Swarm *swarm; 93 PetscErrorCode ierr; 94 95 PetscFunctionBegin; 96 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); 97 ierr = PetscNewLog(dm,&swarm);CHKERRQ(ierr); 98 99 dm->dim = 0; 100 dm->data = swarm; 101 102 dm->ops->view = NULL; 103 dm->ops->load = NULL; 104 dm->ops->setfromoptions = NULL; 105 dm->ops->clone = NULL; 106 dm->ops->setup = NULL; 107 dm->ops->createdefaultsection = NULL; 108 dm->ops->createdefaultconstraints = NULL; 109 dm->ops->createglobalvector = NULL; 110 dm->ops->createlocalvector = NULL; 111 dm->ops->getlocaltoglobalmapping = NULL; 112 dm->ops->createfieldis = NULL; 113 dm->ops->createcoordinatedm = NULL; 114 dm->ops->getcoloring = NULL; 115 dm->ops->creatematrix = NULL; 116 dm->ops->createinterpolation = NULL; 117 dm->ops->getaggregates = NULL; 118 dm->ops->getinjection = NULL; 119 dm->ops->refine = NULL; 120 dm->ops->coarsen = NULL; 121 dm->ops->refinehierarchy = NULL; 122 dm->ops->coarsenhierarchy = NULL; 123 dm->ops->globaltolocalbegin = NULL; 124 dm->ops->globaltolocalend = NULL; 125 dm->ops->localtoglobalbegin = NULL; 126 dm->ops->localtoglobalend = NULL; 127 dm->ops->destroy = DMDestroy_Swarm; 128 dm->ops->createsubdm = NULL; 129 dm->ops->getdimpoints = NULL; 130 dm->ops->locatepoints = NULL; 131 132 PetscFunctionReturn(0); 133 }