| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -14,14 +14,20 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#include "SimTargetOption.h" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#ifdef LINSYSSOLVER_USE_CHOLMOD | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#include "CHOLMODSolver.hpp" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#include "EigenLibSolver.hpp" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#endif | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#include "BoundaryConditions.hpp" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#include "Config.hpp" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#include <igl/read_triangle_mesh.h> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					namespace ipc::rigid{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    class UIStaticSimState; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					namespace ssim { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    struct Model { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixX3d V; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -36,112 +42,142 @@ namespace ssim { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    class StaticSim { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        using MeshModel = Model; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        using Mesh = Model; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        friend class ipc::rigid::UIStaticSimState; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        StaticSim(const SimTargetOption &option, const std::string &jsonPath); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ~StaticSim() {} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void simulation(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /**
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         * Given query points Q, compute their displacements and stress | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         * @param Q (nQ, 3), query points | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         * @param QU return value, (nQ), norm of displacements | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         * @param Qstress return value, (nQ, 6), stress size is (6) on each query point | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void postprocess(Eigen::MatrixXd &Q, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                         Eigen::VectorXd &QU, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                         Eigen::MatrixXd &Qstress); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateTarget(SimTargetOption::Target target) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!option_.is_option_set(target)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // If no cache, update option_ and map_
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                MapAppendTarget(target); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                option_.set_option(target); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // Return cache
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return map_target_to_evaluated_[target]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    StaticSim(const SimTargetOption &option, const std::string &jsonPath); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    ~ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    StaticSim() {} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void simulation(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Mesh GetMeshInDBC() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // TODO: get mesh in DBC box
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Mesh ret; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ret.V = get_mesh().V; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ret.F = get_mesh().F.topRows(100); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return ret; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /**
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * Given query points Q, compute their displacements and stress | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param Q (nQ, 3), query points | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param QU return value, (nQ), norm of displacements | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param Qstress return value, (nQ, 6), stress size is (6) on each query point | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void postprocess(Eigen::MatrixXd &Q, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                     Eigen::VectorXd &QU, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                     Eigen::MatrixXd &Qstress); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateTarget(SimTargetOption::Target target) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!option_.is_option_set(target)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // If no cache, update option_ and map_
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            MapAppendTarget(target); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            option_.set_option(target); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return cache
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return map_target_to_evaluated_[target]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // return surf tri mesh of tet mesh
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Model get_mesh() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // return surf tri mesh of tet mesh
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Model get_mesh(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void computeFeatures(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void computeK(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void solve(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void setBC(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void prepare_surf_result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        void MapAppendTarget(int target); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateUNorm() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateUX() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateUY() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateUZ() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateSNorm() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateSVonMises() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateSX() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateSY() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateSZ() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Return: 1 x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd EvaluateCompliance() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        MeshModel mesh_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        SimTargetOption option_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        std::vector<Eigen::MatrixXd> map_target_to_evaluated_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void computeFeatures(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void computeK(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void solve(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void setBC(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void prepare_surf_result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void MapAppendTarget(int target); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateUNorm() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateUX() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateUY() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateUZ() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateSNorm() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateSVonMises() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateSX() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateSY() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: #mesh.V.rows() x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateSZ() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Return: 1 x 1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd EvaluateCompliance() const; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        std::vector<DirichletBC> DirichletBCs; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        std::vector<NeumannBC> NeumannBCs; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::Matrix<double, 6, 6> D; // constitutive matrix
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // owned data
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int nN, nEle, nDof; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd TV; // vertices coordinates
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd TV1; // deformed vertices coordinates
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXi TT; // vertice index of each tetrahedron
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXi SF; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int eleNodeNum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int eleDofNum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        std::vector<Eigen::VectorXi> eDof; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // owned features
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::VectorXd load; // load of each dof
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::VectorXd U; // dofs' displacement to be computed
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::VectorXi DBC_nI; // vertex in DBC
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::VectorXi isDBC; // 0: not in DBC, 1: in DBC
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::VectorXi SVI; // vertice indices of surface nodes
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXi F_surf; // boundary vertice indices in surface triangles mesh
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // indices for fast access
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        std::vector<std::set<int>> vNeighbor; // records all vertices' indices adjacent to each vertice
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        std::vector<std::set<std::pair<int, int>>> vFLoc; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        std::shared_ptr<LinSysSolver<Eigen::VectorXi, Eigen::VectorXd>> linSysSolver; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // resulted data to evaluate
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        double compliance_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd surf_U_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::MatrixXd surf_stress_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Eigen::VectorXd surf_vonstress_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    MeshModel mesh_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    SimTargetOption option_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<Eigen::MatrixXd> map_target_to_evaluated_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<DirichletBC> DirichletBCs; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<NeumannBC> NeumannBCs; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::Matrix<double, 6, 6> D; // constitutive matrix
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // owned data
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    int nN, nEle, nDof; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd TV; // vertices coordinates
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd TV1; // deformed vertices coordinates
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXi TT; // vertice index of each tetrahedron
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXi SF; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    int eleNodeNum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    int eleDofNum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<Eigen::VectorXi> eDof; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // owned features
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::VectorXd load; // load of each dof
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::VectorXd U; // dofs' displacement to be computed
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::VectorXi DBC_nI; // vertex in DBC
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::VectorXi isDBC; // 0: not in DBC, 1: in DBC
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::VectorXi SVI; // vertice indices of surface nodes
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXi F_surf; // boundary vertice indices in surface triangles mesh
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // indices for fast access
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<std::set<int>> vNeighbor; // records all vertices' indices adjacent to each vertice
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<std::set<std::pair<int, int>>> vFLoc; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::shared_ptr<LinSysSolver<Eigen::VectorXi, Eigen::VectorXd>> linSysSolver; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // resulted data to evaluate
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    double compliance_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd surf_U_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::MatrixXd surf_stress_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Eigen::VectorXd surf_vonstress_; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} // ssim
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |