ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
domain_decomposition_tcl.c
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2010,2012,2013 The ESPResSo project
00003   Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 
00004     Max-Planck-Institute for Polymer Research, Theory Group
00005   
00006   This file is part of ESPResSo.
00007   
00008   ESPResSo is free software: you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation, either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   ESPResSo is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with this program.  If not, see <http://www.gnu.org/licenses/>. 
00020 */
00021 /** \file domain_decomposition.c
00022  *
00023  *  This file contains everything related to the cell system: domain decomposition.
00024  *  See also \ref domain_decomposition.h
00025  */
00026 #include "utils.h"
00027 #include "parser.h"
00028 
00029 #include "domain_decomposition.h"
00030 
00031 /** half the number of cell neighbors in 3 Dimensions. */
00032 #define CELLS_MAX_NEIGHBORS 14
00033 
00034 /*@}*/
00035 
00036 /************************************************/
00037 /** \name Variables */
00038 /************************************************/
00039 /*@{*/
00040 
00041 extern int max_num_cells ;
00042 extern int min_num_cells ;
00043 extern double max_skin  ; 
00044 
00045 /*@}*/
00046 
00047 
00048 int tclcallback_max_num_cells(Tcl_Interp *interp, void *_data)
00049 {
00050   int data = *(int *)_data;
00051   if (data < min_num_cells) {
00052     Tcl_AppendResult(interp, "max_num_cells cannot be smaller than min_num_cells", (char *) NULL);
00053     return (TCL_ERROR);
00054   }
00055   max_num_cells = data;
00056   mpi_bcast_parameter(FIELD_MAXNUMCELLS);
00057   return (TCL_OK);
00058 }
00059 
00060 int tclcallback_min_num_cells(Tcl_Interp *interp, void *_data)
00061 {
00062   char buf[TCL_INTEGER_SPACE];
00063   int data = *(int *)_data;
00064   int min = calc_processor_min_num_cells();
00065 
00066   if (data < min) {
00067     sprintf(buf, "%d", min);
00068     Tcl_AppendResult(interp, "min_num_cells must be at least ", buf, (char *) NULL);
00069     return (TCL_ERROR);
00070   }
00071   if (data > max_num_cells) {
00072     Tcl_AppendResult(interp, "min_num_cells cannot be larger than max_num_cells", (char *) NULL);
00073     return (TCL_ERROR);
00074   }
00075   min_num_cells = data;
00076   mpi_bcast_parameter(FIELD_MINNUMCELLS);
00077   return (TCL_OK);
00078 }
00079 
00080 
00081 /************************************************************/