18 #include "libmesh/coupling_matrix.h"    19 #include "libmesh/dense_matrix.h"    20 #include "libmesh/dense_vector.h"    21 #include "libmesh/dof_map.h"    22 #include "libmesh/elem.h"    23 #include "libmesh/equation_systems.h"    24 #include "libmesh/fe.h"    25 #include "libmesh/gmv_io.h"    26 #include "libmesh/libmesh.h"    27 #include "libmesh/linear_implicit_system.h"    28 #include "libmesh/mesh.h"    29 #include "libmesh/mesh_refinement.h"    30 #include "libmesh/numeric_vector.h"    31 #include "libmesh/quadrature_gauss.h"    32 #include "libmesh/sparse_matrix.h"    39               const std::string & system_name);
    45 #ifdef LIBMESH_ENABLE_AMR    46 int main (
int argc, 
char ** argv)
    50   libmesh_error_msg_if(argc < 4, 
"Usage: ./prog -d DIM filename");
    53   const unsigned char dim = cast_int<unsigned char>(atoi(argv[2]));
    55   std::string meshname  (argv[3]);
   119 int main (
int, 
char **)
   121   std::cout << 
"This libMesh was built with --disable-amr" << std::endl;
   132               const std::string & libmesh_dbg_var(system_name))
   134   libmesh_assert_equal_to (system_name, 
"primary");
   146   fe->attach_quadrature_rule (&qrule);
   151   fe_face->attach_quadrature_rule(&qface);
   158   const std::vector<Real> & JxW_face                   = fe_face->get_JxW();
   159   const std::vector<Real> & JxW                        = fe->get_JxW();
   160   const std::vector<Point> & q_point                   = fe->get_xyz();
   161   const std::vector<std::vector<Real>> & phi          = fe->get_phi();
   162   const std::vector<std::vector<RealGradient>> & dphi = fe->get_dphi();
   164   std::vector<dof_id_type> dof_indices_U;
   165   std::vector<dof_id_type> dof_indices_V;
   173   Real vol=0., area=0.;
   177   for (
const auto & elem : 
mesh.active_local_element_ptr_range())
   188       const unsigned int n_phi = cast_int<unsigned int>(phi.size());
   191       Kuu.
resize (n_phi, n_phi);
   193       Kvv.
resize (n_phi, n_phi);
   199       for (
unsigned int gp=0; gp<qrule.
n_points(); gp++)
   201           for (
unsigned int i=0; i<n_phi; ++i)
   209               const Real f = q_point[gp]*q_point[gp];
   216               Fu(i) += JxW[gp]*f*phi[i][gp];
   217               Fv(i) += JxW[gp]*f*phi[i][gp];
   219               for (
unsigned int j=0; j != n_phi; ++j)
   222                   Kuu(i,j) += JxW[gp]*((phi[i][gp])*(phi[j][gp]));
   224                   Kvv(i,j) += JxW[gp]*((phi[i][gp])*(phi[j][gp]) +
   225                                        1.*((dphi[i][gp])*(dphi[j][gp])));
   235           for (
auto side : elem->side_index_range())
   236             if (elem->neighbor_ptr(side) == 
nullptr)
   238                 fe_face->reinit (elem, side);
   240                 for (
const auto & val : JxW_face)
 class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
This is the EquationSystems class. 
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file. 
virtual void write(const std::string &) override
This method implements writing a mesh to a specified file. 
void constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix and vector. 
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
void resize(const unsigned int n)
Resize the vector. 
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i]...
void print_info(std::ostream &os=libMesh::out) const
Prints information about the equation systems, by default to libMesh::out. 
void set_refinement_flag(const RefinementState rflag)
Sets the value of the refinement flag for the element. 
void resize(const std::size_t n)
Resizes the matrix and initializes all entries to be 0. 
NumericVector< Number > * rhs
The system matrix. 
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g. 
The libMesh namespace provides an interface to certain functionality in the library. 
This class implements writing meshes in the GMV format. 
virtual void solve() override
Assembles & solves the linear system A*x=b. 
const T_sys & get_system(std::string_view name) const
This is the MeshBase class. 
This class handles the numbering of degrees of freedom on a mesh. 
void assemble(EquationSystems &es, const std::string &system_name)
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols)=0
Add the full matrix dm to the SparseMatrix. 
Implements (adaptive) mesh refinement algorithms for a MeshBase. 
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh. 
virtual void reinit()
Handle any mesh changes and reinitialize all the systems on the updated mesh. 
void print_dof_constraints(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
Prints (from processor 0) all DoF and Node constraints. 
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary. 
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type. 
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system. 
unsigned int n_points() const
CouplingMatrix * _dof_coupling
Degree of freedom coupling. 
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in assembling the system matrix and RHS. 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
int main(int argc, char **argv)
bool refine_and_coarsen_elements()
Refines and coarsens user-requested elements. 
const MeshBase & get_mesh() const
virtual const Elem & elem_ref(const dof_id_type i) const
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero(). 
This class implements specific orders of Gauss quadrature. 
unsigned int mesh_dimension() const
virtual void init()
Initialize all the systems. 
virtual System & add_system(std::string_view system_type, std::string_view name)
Add the system of type system_type named name to the systems array. 
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default. 
const DofMap & get_dof_map() const
const SparseMatrix< Number > & get_system_matrix() const
void uniformly_refine(unsigned int n=1)
Uniformly refines the mesh n times.