コード例 #1
0
 DenseVector<double> OneD_Node_Mesh<double, double>::find_roots1( const std::size_t &var, double value ) const
 {
   DenseVector<double> roots;
   for ( std::size_t node = 0; node < X.size() - 1; ++node )
   {
     std::size_t offset( node * NV + var );
     // find bracket nodes
     if ( ( VARS[ offset ] - value ) * ( VARS[ offset + NV ] - value ) < 0.0 )
     {
       double deriv = ( VARS[ offset + NV ] - VARS[ offset ] ) / ( X[ node + 1 ] - X[ node ] );
       double x = X[ node ] + ( value - VARS[ offset ] ) / deriv;
       // add the left hand node to the roots vector
       roots.push_back( x );
     }
   }
   return roots;
 }
コード例 #2
0
 DenseVector<D_complex> DenseLinearEigenSystem<_Type>::get_tagged_eigenvalues() const
 {
   if ( TAGGED_INDICES.size() == 0 )
   {
     std::string problem;
     problem = "In DenseLinearEigenSystem.get_tagged_eigenvalues() : there are\n";
     problem += "no eigenvalues that have been tagged. This set is empty.\n";
     throw ExceptionRuntime( problem );
   }
   // storage for the eigenvalues
   DenseVector<D_complex> evals;
   // loop through the tagged set
   for ( iter p = TAGGED_INDICES.begin(); p != TAGGED_INDICES.end(); ++p )
   {
     // get the index of the relevant eigenvalue from the set
     std::size_t j = *p;
     // work out the complex eigenvalue associated with this index
     // and add it to the vector
     evals.push_back( EIGENVALUES_ALPHA[ j ] / EIGENVALUES_BETA[ j ] );
   }
   // return the complex vector of eigenvalues
   return evals;
 }