package AMRElliptic; import BoxTools.BoxLayout; import BoxTools.BoxLayoutData; import BoxTools.BoxedArray; import BoxTools.Util; import BoxTools.LayoutIterator; import BoxTools.DataIndex; import BoxTools.PAPIWrapper; import AMRTools.QuadCFInterp; import AMRTools.CoarseAverage; import AMRTools.ConstantFineInterp; import java.lang.Math; /** * LevelOp defines operations involving the Possion operator at one level. It also * enforces the physical boundary condition. The physical boundary is cached for better performance. * The definition of LevelOp depends on the current level layout and the layout at the * coarser level. Among the operations it defines, included are two multigrid solvers for one level of * data. One for the case where there is a coarser level data, and another one for the bottom level. * Intermediate data structures and operators are reused to save resources. * LevelOp should be an interface or abstract class, which defines the interface between * AMRSolver and specific definition of an elliptic solver. However, since Titanium * currently does not support inheritance involving a template class, it is impossible for a class * for example PossionOp to extends or implements LevelOp. The current * implementation just combines these two classes into one. * The details of the multigrid algorithms are available in Chombo Design Document. *

Usage: a LevelOp object must be declared local. * @see BoxLayout,BoxLayoutData,BoxedArray,LayoutIterator,QuadCFInterp,CoarseAverage,ConstantFineInterp. * @see Chombo Specification * @version 1.1 * Modified on Jul 09, 2004. change of syntax of foreach, see BoxTools/foreachLoopTest.ti. * on Aug 26, 2004. BoxLayoutData.<<=constant covers ghost cells. * @author Tong Wen, LBNL * @since 1.0 */ public abstract class LevelOp{ protected static final int SPACE_DIM =Util.SPACE_DIM; protected static final int SORT_DIM =Util.SORT_DIM; protected final static int highBoundary=Util.HIGH_SIDE; protected final static int lowBoundary=Util.LOW_SIDE; protected final static RectDomain NULL_BOX=Util.NULL_BOX; protected final static int numVCycle=Util.NUMVCYCLE; protected final static int numBVCycle=Util.NUMBVCYCLE; final static double R=0.25; final static double a=2/(25*R*R*R); final static double b=3/(16*R*R); /*the above info should be obtained only from Util class.*/ protected static Point DISP1, DISP2, DISP3; BoxLayout local single m_layout,m_layoutC; double single m_Dx; int single m_refRatio; //must be a power of 2 int single m_mgLevels; boolean single m_homogeneousOnly; RectDomain single m_domain; RectDomain single m_domainc; int single m_numSmoothDown, m_numSmoothUp; boolean single m_isBottom; //add public for test public LayoutIterator local m_layoutItr, m_layoutItrC; BoxLayout local [] local m_boundaries=new BoxLayout local [2*SPACE_DIM]; boolean [] local [] local m_isPhyBoundary=new boolean [2*SPACE_DIM] local [] local; template QuadCFInterp local single m_CFinterp; template CoarseAverage local single m_Average; template ConstantFineInterp local single m_Ipwc; /** data structures for mgRelax */ template BoxLayoutData