<commit_before>//---------------------------------------------------------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//---------------------------------------------------------------------------


// check ConstraintMatrix.distribute() for a distributed mesh
// with Trilinos

#include "../tests.h"
#include "coarse_grid_common.h"
#include <deal.II/base/logstream.h>
#include <deal.II/base/tensor.h>
#include <deal.II/grid/tria.h>
#include <deal.II/distributed/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_tools.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/lac/trilinos_vector.h>

#include <deal.II/fe/fe_q.h>

#include <fstream>
#include <sstream>

template<int dim>
void test()
{
  unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
  unsigned int numproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);

  if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
    deallog << "hyper_cube" << std::endl;

  parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);

  GridGenerator::hyper_cube(tr);
  tr.refine_global (2);
  for (unsigned int step=0; step<15; ++step)
        {
          typename Triangulation<dim>::active_cell_iterator
            cell = tr.begin_active(),
            endc = tr.end();

            for (; cell!=endc; ++cell)
                if (std::rand()%42==1)
                cell->set_refine_flag ();

         tr.execute_coarsening_and_refinement ();
        }

  DoFHandler<dim> dofh(tr);

  static const FE_Q<dim> fe(1);
  dofh.distribute_dofs (fe);

  IndexSet owned_set = dofh.locally_owned_dofs();

  IndexSet dof_set;
  DoFTools::extract_locally_active_dofs (dofh, dof_set);

  IndexSet relevant_set;
  DoFTools::extract_locally_relevant_dofs (dofh, relevant_set);

  TrilinosWrappers::MPI::Vector x;
  x.reinit(owned_set, MPI_COMM_WORLD);
  x=2.0;
  x.compress();

  TrilinosWrappers::MPI::Vector x_rel;
  x_rel.reinit(relevant_set, MPI_COMM_WORLD);
  x_rel.compress();

  ConstraintMatrix cm(relevant_set);
  DoFTools::make_hanging_node_constraints (dofh, cm);
  cm.close ();

  cm.distribute(x);
  x_rel = x;

				   //x.print(std::cout);

//  x_rel.print(std::cout);

  TrilinosWrappers::Vector x_dub;
  x_dub.reinit(dof_set.size());

  x_dub = x_rel;

  {
	std::stringstream out;
    out << "**** proc " << myid << std::endl;
    x_dub.print (out);

	if (myid==0)
	  deallog << out.str() << std::endl;
	else
	  MPI_Send((void*)out.str().c_str(),out.str().size()+1, MPI_CHAR, 0, 1, MPI_COMM_WORLD);
  }

  if (myid == 0)
    {
      for (unsigned int i = 1;i < numproc;++i)
        {
		  MPI_Status status;
		  int msglen;
		  MPI_Probe(i, 1, MPI_COMM_WORLD, &status);
		  MPI_Get_count(&status, MPI_CHAR, &msglen);
		  std::vector<char> buf(msglen);
		  MPI_Recv(&buf[0], msglen, MPI_CHAR, status.MPI_SOURCE, 1,
                 MPI_COMM_WORLD, &status);
		  deallog << &buf[0] << std::endl;
        }
    }

}


int main(int argc, char *argv[])
{
  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);

  unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);


  deallog.push(Utilities::int_to_string(myid));

  if (myid == 0)
    {
      std::ofstream logfile(output_file_for_mpi("p4est_3d_constraintmatrix_02").c_str());
      deallog.attach(logfile);
      deallog.depth_console(0);
      deallog.threshold_double(1.e-10);

      deallog.push("2d");
      test<2>();
      deallog.pop();
    }
  else
    test<2>();

}
<commit_msg>remove deprecated compress calls<commit_after>//---------------------------------------------------------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//---------------------------------------------------------------------------


// check ConstraintMatrix.distribute() for a distributed mesh
// with Trilinos

#include "../tests.h"
#include "coarse_grid_common.h"
#include <deal.II/base/logstream.h>
#include <deal.II/base/tensor.h>
#include <deal.II/grid/tria.h>
#include <deal.II/distributed/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_tools.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/lac/trilinos_vector.h>

#include <deal.II/fe/fe_q.h>

#include <fstream>
#include <sstream>

template<int dim>
void test()
{
  unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
  unsigned int numproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);

  if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
    deallog << "hyper_cube" << std::endl;

  parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);

  GridGenerator::hyper_cube(tr);
  tr.refine_global (2);
  for (unsigned int step=0; step<15; ++step)
        {
          typename Triangulation<dim>::active_cell_iterator
            cell = tr.begin_active(),
            endc = tr.end();

            for (; cell!=endc; ++cell)
                if (std::rand()%42==1)
                cell->set_refine_flag ();

         tr.execute_coarsening_and_refinement ();
        }

  DoFHandler<dim> dofh(tr);

  static const FE_Q<dim> fe(1);
  dofh.distribute_dofs (fe);

  IndexSet owned_set = dofh.locally_owned_dofs();

  IndexSet dof_set;
  DoFTools::extract_locally_active_dofs (dofh, dof_set);

  IndexSet relevant_set;
  DoFTools::extract_locally_relevant_dofs (dofh, relevant_set);

  TrilinosWrappers::MPI::Vector x;
  x.reinit(owned_set, MPI_COMM_WORLD);
  x=2.0;

  TrilinosWrappers::MPI::Vector x_rel;
  x_rel.reinit(relevant_set, MPI_COMM_WORLD);

  ConstraintMatrix cm(relevant_set);
  DoFTools::make_hanging_node_constraints (dofh, cm);
  cm.close ();

  cm.distribute(x);
  x_rel = x;

				   //x.print(std::cout);

//  x_rel.print(std::cout);

  TrilinosWrappers::Vector x_dub;
  x_dub.reinit(dof_set.size());

  x_dub = x_rel;

  {
	std::stringstream out;
    out << "**** proc " << myid << std::endl;
    x_dub.print (out);

	if (myid==0)
	  deallog << out.str() << std::endl;
	else
	  MPI_Send((void*)out.str().c_str(),out.str().size()+1, MPI_CHAR, 0, 1, MPI_COMM_WORLD);
  }

  if (myid == 0)
    {
      for (unsigned int i = 1;i < numproc;++i)
        {
		  MPI_Status status;
		  int msglen;
		  MPI_Probe(i, 1, MPI_COMM_WORLD, &status);
		  MPI_Get_count(&status, MPI_CHAR, &msglen);
		  std::vector<char> buf(msglen);
		  MPI_Recv(&buf[0], msglen, MPI_CHAR, status.MPI_SOURCE, 1,
                 MPI_COMM_WORLD, &status);
		  deallog << &buf[0] << std::endl;
        }
    }

}


int main(int argc, char *argv[])
{
  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);

  unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);


  deallog.push(Utilities::int_to_string(myid));

  if (myid == 0)
    {
      std::ofstream logfile(output_file_for_mpi("p4est_3d_constraintmatrix_02").c_str());
      deallog.attach(logfile);
      deallog.depth_console(0);
      deallog.threshold_double(1.e-10);

      deallog.push("2d");
      test<2>();
      deallog.pop();
    }
  else
    test<2>();

}

{'fraction_non_alphanumeric': 0.18640874262027385, 'fraction_numerical': 0.012561236025624922, 'mean_word_length': 2.9929789368104314, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4614741', 'n_tokens_mistral': 3229, 'n_tokens_neox': 2989, 'n_words': 523}