MOAB: Mesh Oriented datABase  (version 5.2.1)
InstructionQueue.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2004 Sandia Corporation and Argonne National
00005     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
00006     with Sandia Corporation, the U.S. Government retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
00024     pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov
00025 
00026   ***************************************************************** */
00027 // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3
00028 // -*-
00029 
00030 /*! \file InstructionQueue.hpp
00031 
00032 Header file for the MBMesquite::InstructionQueue class
00033 
00034   \author Thomas Leurent
00035   \date   2002-05-01
00036  */
00037 
00038 #ifndef MSQ_INSTRUCTION_QUEUE_HPP
00039 #define MSQ_INSTRUCTION_QUEUE_HPP
00040 
00041 #include "Mesquite.hpp"
00042 #include "IQInterface.hpp"
00043 
00044 #include <list>
00045 
00046 namespace MBMesquite
00047 {
00048 
00049 class MsqError;
00050 class QualityImprover;
00051 class QualityAssessor;
00052 class Mesh;
00053 class ParallelMesh;
00054 class MeshDomain;
00055 class MeshDomainAssoc;
00056 class Instruction;
00057 class MappingFunctionSet;
00058 class TargetWriter;
00059 class VertexSlaver;
00060 class TagVertexMesh;
00061 
00062 /*! \class InstructionQueue
00063   \brief An InstructionQueue object gathers Mesquite Instructions and ensures
00064          that the instruction queue is coherent for mesh improvement and/or
00065          mesh quality assessment purposes.
00066 
00067          The user can instantiate several InstructionQueue objects to be used
00068          with various MeshSet objects.
00069 
00070          The most commonly used functions are:
00071          -# add_preconditioner(...)
00072          -# add_quality_assessor(...)
00073          -# set_master_quality_improver(...)
00074          -# run_instructions(...)
00075 */
00076 class InstructionQueue : public IQInterface
00077 {
00078 
00079   public:
00080     MESQUITE_EXPORT
00081     InstructionQueue();
00082 
00083     MESQUITE_EXPORT
00084     InstructionQueue( const Settings& settings );
00085 
00086     MESQUITE_EXPORT
00087     virtual ~InstructionQueue();
00088 
00089     MESQUITE_EXPORT
00090     void add_target_calculator( TargetWriter* tc, MsqError& err );
00091 
00092     //! Add a tool mark higher-order nodes as slaved.
00093     //! Note:  Implies set_slaved_ho_node_mode( Settings::SLAVE_CALCULATED )
00094     MESQUITE_EXPORT
00095     void add_vertex_slaver( VertexSlaver* slaver, MsqError& err );
00096     //! Remove a tool mark higher-order nodes as slaved.
00097     //! Note:  Implies set_slaved_ho_node_mode( Settings::SLAVE_ALL )
00098     MESQUITE_EXPORT
00099     void remove_vertex_slaver( VertexSlaver* slaver, MsqError& err );
00100 
00101     MESQUITE_EXPORT
00102     void add_tag_vertex_mesh( TagVertexMesh* m, MsqError& err );
00103     MESQUITE_EXPORT
00104     void remove_tag_vertex_mesh( TagVertexMesh* m, MsqError& err );
00105 
00106     MESQUITE_EXPORT
00107     void add_preconditioner( QualityImprover* instr, MsqError& err );
00108     MESQUITE_EXPORT
00109     void remove_preconditioner( size_t index, MsqError& err );
00110     MESQUITE_EXPORT
00111     void insert_preconditioner( QualityImprover* instr, size_t index, MsqError& err );
00112 
00113     MESQUITE_EXPORT
00114     void add_quality_assessor( QualityAssessor* instr, MsqError& err );
00115     MESQUITE_EXPORT
00116     void remove_quality_assessor( size_t index, MsqError& err );
00117     MESQUITE_EXPORT
00118     void insert_quality_assessor( QualityAssessor* instr, size_t index, MsqError& err );
00119 
00120     MESQUITE_EXPORT
00121     void set_master_quality_improver( QualityImprover* instr, MsqError& err );
00122 
00123     MESQUITE_EXPORT
00124     void disable_automatic_quality_assessment()
00125     {
00126         autoQualAssess = false;
00127     }
00128     MESQUITE_EXPORT
00129     void enable_automatic_quality_assessment()
00130     {
00131         autoQualAssess = true;
00132     }
00133 
00134     /**\brief Exectute the instruction queue.
00135      *
00136      * Execute all operations in the instruction queue.
00137      *
00138      *\param mesh   The mesh to run each instruction on.
00139      *\param domain The domain of the mesh -- may be NULL if no domain.
00140      */
00141     MESQUITE_EXPORT
00142     virtual void run_common( MeshDomainAssoc* mesh_and_domain, ParallelMesh* pmesh, Settings* settings, MsqError& err );
00143 
00144     MESQUITE_EXPORT
00145     void clear();
00146 
00147   protected:
00148   private:
00149     std::list< Instruction* >::iterator clear_master( MsqError& err );
00150 
00151     std::list< Instruction* > instructions;
00152 
00153     bool autoQualAssess;
00154 
00155     int vertexSlaverCount;
00156     size_t nbPreConditionners;
00157     bool isMasterSet;
00158     size_t masterInstrIndex;  //!< 0-based. Keeping an index instead of an iterator
00159                               //!< in case list is reallocated
00160 };
00161 
00162 }  // namespace MBMesquite
00163 
00164 #endif  // InstructionQueue_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines