/////////////////////////
// BOUNDARY CONDITIONS //
/////////////////////////
- void set_boundary_conditions(std::vector<unsigned int> boundary_values_id_u,
+ void set_boundary_conditions(std::vector<types::global_dof_index> &boundary_values_id_u,
std::vector<double> boundary_values_u);
//////////////////
// SET VELOCITY //
// MY PETSC WRAPPERS //
///////////////////////
void get_vector_values(PETScWrappers::VectorBase &vector,
- const std::vector<unsigned int> &indices,
+ const std::vector<types::global_dof_index> &indices,
std::vector<PetscScalar> &values);
void get_vector_values(PETScWrappers::VectorBase &vector,
- const std::vector<unsigned int> &indices,
+ const std::vector<types::global_dof_index> &indices,
std::map<types::global_dof_index, types::global_dof_index> &map_from_Q1_to_Q2,
std::vector<PetscScalar> &values);
std_cxx1x::shared_ptr<PETScWrappers::PreconditionBoomerAMG> MC_preconditioner;
// BOUNDARIES
- std::vector<unsigned int> boundary_values_id_u;
+ std::vector<types::global_dof_index> boundary_values_id_u;
std::vector<double> boundary_values_u;
//////////////
////////// BOUNDARY CONDITIONS //////////
/////////////////////////////////////////
template <int dim>
-void LevelSetSolver<dim>::set_boundary_conditions(std::vector<unsigned int> boundary_values_id_u,
+void LevelSetSolver<dim>::set_boundary_conditions(std::vector<types::global_dof_index> &boundary_values_id_u,
std::vector<double> boundary_values_u)
{
this->boundary_values_id_u = boundary_values_id_u;
const unsigned int n_q_points = quadrature_formula.size();
Vector<double> cell_ML (dofs_per_cell);
- std::vector<unsigned int> local_dof_indices (dofs_per_cell);
+ std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
typename DoFHandler<dim>::active_cell_iterator
cell_LS = dof_handler_LS.begin_active(),
const unsigned int n_q_points = quadrature_formula.size();
FullMatrix<double> cell_MC (dofs_per_cell, dofs_per_cell);
- std::vector<unsigned int> local_dof_indices (dofs_per_cell);
+ std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
std::vector<double> shape_values(dofs_per_cell);
typename DoFHandler<dim>::active_cell_iterator
Vector<double> un_dofs(dofs_per_cell);
- std::vector<unsigned int> indices_LS (dofs_per_cell);
+ std::vector<types::global_dof_index> indices_LS (dofs_per_cell);
// loop on cells
typename DoFHandler<dim>::active_cell_iterator
dLij_matrix = 0;
dCij_matrix = 0;
- int ncolumns;
- const int *gj;
- const double *Cxi, *Cyi, *Czi, *CTxi, *CTyi, *CTzi;
- const double *EntResi, *SuppSizei, *MCi;
+ PetscInt ncolumns;
+ const PetscInt *gj;
+ const PetscScalar *Cxi, *Cyi, *Czi, *CTxi, *CTyi, *CTzi;
+ const PetscScalar *EntResi, *SuppSizei, *MCi;
double solni;
Tensor<1,dim> vi,vj;
for (;idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++)
{
- int gi = *idofs_iter;
+ PetscInt gi = *idofs_iter;
//double ith_K_times_solution = 0;
// read velocity of i-th DOF
MatGetRow(MC_matrix,gi,&ncolumns,&gj,&MCi);
// get vector values for column indices
- const std::vector<unsigned int> gj_indices (gj,gj+ncolumns);
+ const std::vector<types::global_dof_index> gj_indices (gj,gj+ncolumns);
std::vector<double> soln(ncolumns);
std::vector<double> vx(ncolumns);
std::vector<double> vy(ncolumns);
int gi = *idofs_iter;
// get solution at DOFs on the sparsity pattern of i-th DOF
- std::vector<unsigned int> gj_indices = sparsity_pattern[gi];
+ std::vector<types::global_dof_index> gj_indices = sparsity_pattern[gi];
std::vector<double> soln(gj_indices.size());
get_vector_values(un_solution,gj_indices,soln);
// compute bounds, ith row of flux matrix, P vectors
{
// compute min and max vectors
const unsigned int dofs_per_cell = fe_LS.dofs_per_cell;
- std::vector<unsigned int> local_dof_indices (dofs_per_cell);
+ std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
double tol=1e-10;
typename DoFHandler<dim>::active_cell_iterator
// loop on locally owned i-DOFs (rows)
IndexSet::ElementIterator idofs_iter = locally_owned_dofs_LS.begin();
- int ncolumns;
- const int *gj;
- const double *MCi, *dLi, *dCi;
+ PetscInt ncolumns;
+ const PetscInt *gj;
+ const PetscScalar *MCi, *dLi, *dCi;
double solni, mi, solLi, solHi;
for (;idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++)
MatGetRow(dCij_matrix,gi,&ncolumns,&gj,&dCi);
// get vector values for support of i-th DOF
- const std::vector<unsigned int> gj_indices (gj,gj+ncolumns);
+ const std::vector<types::global_dof_index> gj_indices (gj,gj+ncolumns);
std::vector<double> soln(ncolumns);
std::vector<double> solH(ncolumns);
get_vector_values(solution,gj_indices,soln);
MatGetRow(A_matrix,gi,&ncolumns,&gj,&Ai);
// get vector values for column indices
- const std::vector<unsigned int> gj_indices (gj,gj+ncolumns);
+ const std::vector<types::global_dof_index> gj_indices (gj,gj+ncolumns);
std::vector<double> Rpos(ncolumns);
std::vector<double> Rneg(ncolumns);
get_vector_values(R_pos_vector,gj_indices,Rpos);
LxAkp1_matrix.copy_from(LxA_matrix);
// loop in num of FCT iterations
- int ncolumns;
- const int *gj;
- const double *Akp1i;
+ PetscInt ncolumns;
+ const PetscInt *gj;
+ const PetscScalar *Akp1i;
double mi;
for (int iter=0; iter<NUM_ITER; iter++)
{
// get i-th row of matrices
MatGetRow(Akp1_matrix,gi,&ncolumns,&gj,&Akp1i);
// get vector values for support of i-th DOF
- const std::vector<unsigned int> gj_indices (gj,gj+ncolumns);
+ const std::vector<types::global_dof_index> gj_indices (gj,gj+ncolumns);
std::vector<double> soln(ncolumns);
get_vector_values(un_solution,gj_indices,soln);
MatGetRow(Akp1_matrix,gi,&ncolumns,&gj,&Akp1i);
// get vector values for column indices
- const std::vector<unsigned int> gj_indices(gj,gj+ncolumns);
+ const std::vector<types::global_dof_index> gj_indices(gj,gj+ncolumns);
std::vector<double> Rpos(ncolumns);
std::vector<double> Rneg(ncolumns);
get_vector_values(R_pos_vector,gj_indices,Rpos);
{
// loop on DOFs
IndexSet::ElementIterator idofs_iter = locally_owned_dofs_LS.begin();
- int ncolumns;
- const int *gj;
- const double *MCi;
+ PetscInt ncolumns;
+ const PetscInt *gj;
+ const PetscScalar *MCi;
for (;idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++)
{
- int gi = *idofs_iter;
+ PetscInt gi = *idofs_iter;
// get i-th row of mass matrix (dummy, I just need the indices gj)
MatGetRow(MC_matrix,gi,&ncolumns,&gj,&MCi);
sparsity_pattern[gi] = std::vector<types::global_dof_index>(gj,gj+ncolumns);
{
map_from_Q1_to_Q2.clear();
const unsigned int dofs_per_cell_LS = fe_LS.dofs_per_cell;
- std::vector<unsigned int> local_dof_indices_LS (dofs_per_cell_LS);
+ std::vector<types::global_dof_index> local_dof_indices_LS (dofs_per_cell_LS);
const unsigned int dofs_per_cell_U = fe_U.dofs_per_cell;
- std::vector<unsigned int> local_dof_indices_U (dofs_per_cell_U);
+ std::vector<types::global_dof_index> local_dof_indices_U (dofs_per_cell_U);
typename DoFHandler<dim>::active_cell_iterator
cell_LS = dof_handler_LS.begin_active(),
// ------------------------------------------------------------------------------- //
template<int dim>
void LevelSetSolver<dim>::get_vector_values (PETScWrappers::VectorBase &vector,
- const std::vector<unsigned int> &indices,
+ const std::vector<types::global_dof_index> &indices,
std::vector<PetscScalar> &values)
{
// PETSc wrapper to get sets of values from a petsc vector.
IndexSet ghost_indices = locally_relevant_dofs_LS;
ghost_indices.subtract_set(locally_owned_dofs_LS);
- int n_idx, begin, end, i;
+ PetscInt n_idx, begin, end, i;
n_idx = indices.size();
VecGetOwnershipRange (vector, &begin, &end);
template<int dim>
void LevelSetSolver<dim>::get_vector_values (PETScWrappers::VectorBase &vector,
- const std::vector<unsigned int> &indices,
+ const std::vector<types::global_dof_index> &indices,
std::map<types::global_dof_index, types::global_dof_index> &map_from_Q1_to_Q2,
std::vector<PetscScalar> &values)
{
IndexSet ghost_indices = locally_relevant_dofs_U;
ghost_indices.subtract_set(locally_owned_dofs_U);
- int n_idx, begin, end, i;
+ PetscInt n_idx, begin, end, i;
n_idx = indices.size();
VecGetOwnershipRange (vector, &begin, &end);
private:
void set_boundary_inlet();
void get_boundary_values_U();
- void get_boundary_values_phi(std::vector<unsigned int> &boundary_values_id_phi,
+ void get_boundary_values_phi(std::vector<types::global_dof_index> &boundary_values_id_phi,
std::vector<double> &boundary_values_phi);
void output_results();
void output_vectors();
PETScWrappers::MPI::Vector completely_distributed_solution_v;
PETScWrappers::MPI::Vector completely_distributed_solution_p;
// BOUNDARY VECTORS
- std::vector<unsigned int> boundary_values_id_u;
- std::vector<unsigned int> boundary_values_id_v;
- std::vector<unsigned int> boundary_values_id_phi;
+ std::vector<types::global_dof_index> boundary_values_id_u;
+ std::vector<types::global_dof_index> boundary_values_id_v;
+ std::vector<types::global_dof_index> boundary_values_id_phi;
std::vector<double> boundary_values_u;
std::vector<double> boundary_values_v;
std::vector<double> boundary_values_phi;
template <int dim>
void MultiPhase<dim>::get_boundary_values_U()
{
- std::map<unsigned int, double> map_boundary_values_u;
- std::map<unsigned int, double> map_boundary_values_v;
- std::map<unsigned int, double> map_boundary_values_w;
+ std::map<types::global_dof_index, double> map_boundary_values_u;
+ std::map<types::global_dof_index, double> map_boundary_values_v;
+ std::map<types::global_dof_index, double> map_boundary_values_w;
// NO-SLIP CONDITION
if (PROBLEM==BREAKING_DAM || PROBLEM==FALLING_DROP)
boundary_values_id_v.resize(map_boundary_values_v.size());
boundary_values_u.resize(map_boundary_values_u.size());
boundary_values_v.resize(map_boundary_values_v.size());
- std::map<unsigned int,double>::const_iterator boundary_value_u =map_boundary_values_u.begin();
- std::map<unsigned int,double>::const_iterator boundary_value_v =map_boundary_values_v.begin();
+ std::map<types::global_dof_index,double>::const_iterator boundary_value_u =map_boundary_values_u.begin();
+ std::map<types::global_dof_index,double>::const_iterator boundary_value_v =map_boundary_values_v.begin();
for (int i=0; boundary_value_u !=map_boundary_values_u.end(); ++boundary_value_u, ++i)
{
}
template <int dim>
-void MultiPhase<dim>::get_boundary_values_phi(std::vector<unsigned int> &boundary_values_id_phi,
+void MultiPhase<dim>::get_boundary_values_phi(std::vector<types::global_dof_index> &boundary_values_id_phi,
std::vector<double> &boundary_values_phi)
{
- std::map<unsigned int, double> map_boundary_values_phi;
+ std::map<types::global_dof_index, double> map_boundary_values_phi;
unsigned int boundary_id=0;
set_boundary_inlet();
VectorTools::interpolate_boundary_values (dof_handler_LS,boundary_id,BoundaryPhi<dim>(1.0),map_boundary_values_phi);
boundary_values_id_phi.resize(map_boundary_values_phi.size());
boundary_values_phi.resize(map_boundary_values_phi.size());
- std::map<unsigned int,double>::const_iterator boundary_value_phi = map_boundary_values_phi.begin();
+ std::map<types::global_dof_index,double>::const_iterator boundary_value_phi = map_boundary_values_phi.begin();
for (int i=0; boundary_value_phi !=map_boundary_values_phi.end(); ++boundary_value_phi, ++i)
{
boundary_values_id_phi[i]=boundary_value_phi->first;
PETScWrappers::MPI::Vector locally_relevant_solution_w,
PETScWrappers::MPI::Vector locally_relevant_solution_p);
//boundary conditions
- void set_boundary_conditions(std::vector<unsigned int> boundary_values_id_u,
- std::vector<unsigned int> boundary_values_id_v, std::vector<double> boundary_values_u,
+ void set_boundary_conditions(std::vector<types::global_dof_index> boundary_values_id_u,
+ std::vector<types::global_dof_index> boundary_values_id_v, std::vector<double> boundary_values_u,
std::vector<double> boundary_values_v);
- void set_boundary_conditions(std::vector<unsigned int> boundary_values_id_u,
- std::vector<unsigned int> boundary_values_id_v,
- std::vector<unsigned int> boundary_values_id_w, std::vector<double> boundary_values_u,
+ void set_boundary_conditions(std::vector<types::global_dof_index> boundary_values_id_u,
+ std::vector<types::global_dof_index> boundary_values_id_v,
+ std::vector<types::global_dof_index> boundary_values_id_w, std::vector<double> boundary_values_u,
std::vector<double> boundary_values_v, std::vector<double> boundary_values_w);
void set_velocity(PETScWrappers::MPI::Vector locally_relevant_solution_u,
PETScWrappers::MPI::Vector locally_relevant_solution_v);
ConstraintMatrix constraints;
ConstraintMatrix constraints_psi;
- std::vector<unsigned int> boundary_values_id_u;
- std::vector<unsigned int> boundary_values_id_v;
- std::vector<unsigned int> boundary_values_id_w;
+ std::vector<types::global_dof_index> boundary_values_id_u;
+ std::vector<types::global_dof_index> boundary_values_id_v;
+ std::vector<types::global_dof_index> boundary_values_id_w;
std::vector<double> boundary_values_u;
std::vector<double> boundary_values_v;
std::vector<double> boundary_values_w;
}
template<int dim>
-void NavierStokesSolver<dim>::set_boundary_conditions(std::vector<unsigned int> boundary_values_id_u,
- std::vector<unsigned int> boundary_values_id_v,
+void NavierStokesSolver<dim>::set_boundary_conditions(std::vector<types::global_dof_index> boundary_values_id_u,
+ std::vector<types::global_dof_index> boundary_values_id_v,
std::vector<double> boundary_values_u,
std::vector<double> boundary_values_v)
{
}
template<int dim>
-void NavierStokesSolver<dim>::set_boundary_conditions(std::vector<unsigned int> boundary_values_id_u,
- std::vector<unsigned int> boundary_values_id_v,
- std::vector<unsigned int> boundary_values_id_w,
+void NavierStokesSolver<dim>::set_boundary_conditions(std::vector<types::global_dof_index> boundary_values_id_u,
+ std::vector<types::global_dof_index> boundary_values_id_v,
+ std::vector<types::global_dof_index> boundary_values_id_w,
std::vector<double> boundary_values_u,
std::vector<double> boundary_values_v,
std::vector<double> boundary_values_w)
std::vector<Tensor<1, dim> > grad_psiqn(n_q_points);
std::vector<Tensor<1, dim> > grad_psiqnm1(n_q_points);
- std::vector<unsigned int> local_dof_indices(dofs_per_cell);
+ std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
std::vector<Tensor<1, dim> > shape_grad(dofs_per_cell);
std::vector<double> shape_value(dofs_per_cell);
std::vector<Tensor<1, dim> > gvnp1(n_q_points);
std::vector<Tensor<1, dim> > gwnp1(n_q_points);
- std::vector<unsigned int> local_dof_indices(dofs_per_cell);
+ std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
std::vector<double> shape_value(dofs_per_cell);
std::vector<Tensor<1, dim> > shape_grad(dofs_per_cell);
for (unsigned int i=0; i<dofs_per_cell; ++i) {
cell_rhs_psi(i)+=-3./2./time_step*rho_min*divU*shape_value[i]*JxW;
cell_rhs_q(i)-=nu_value*divU*shape_value[i]*JxW;
- if (rebuild_S_M==true)
+ if (rebuild_S_M==true) {
for (unsigned int j=0; j<dofs_per_cell; ++j)
if (i==j)
{
cell_S(i,j)+=shape_grad[i]*shape_grad[j]*JxW;
cell_M(i,j)+=shape_value[i]*shape_value[j]*JxW;
}
+ }
}
}
cell_P->get_dof_indices(local_dof_indices);