// check local values
if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
{
- deallog << myid*2 << ":" << PetscRealPart(v(myid*2)) << std::endl;
- deallog << myid*2+1 << ":" << PetscRealPart(v(myid*2+1)) << std::endl;
+ deallog << myid*2 << ":" << get_real_assert_zero_imag(v(myid*2)) << std::endl;
+ deallog << myid*2+1 << ":" << get_real_assert_zero_imag(v(myid*2+1)) << std::endl;
}
- Assert(PetscRealPart(v(myid*2)) == myid*4.0, ExcInternalError());
- Assert(PetscRealPart(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v(myid*2)) == myid*4.0, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError());
// check ghost values
if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
- deallog << "ghost: " << PetscRealPart(v(1)) << std::endl;
- Assert(PetscRealPart(v(1)) == 2.0, ExcInternalError());
+ deallog << "ghost: " << get_real_assert_zero_imag(v(1)) << std::endl;
+ Assert(get_real_assert_zero_imag(v(1)) == 2.0, ExcInternalError());
// done
if (myid==0)
vb = a;
v2 = vb;
if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
- deallog << "ghost: " << PetscRealPart(v2(1)) << std::endl;
- Assert(PetscRealPart(v2(1)) == 1.5, ExcInternalError());
- Assert(PetscRealPart(v2(myid*2)) == 1.5, ExcInternalError());
- Assert(PetscRealPart(v2(myid*2+1)) == 1.5, ExcInternalError());
+ deallog << "ghost: " << get_real_assert_zero_imag(v2(1)) << std::endl;
+ Assert(get_real_assert_zero_imag(v2(1)) == 1.5, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v2(myid*2)) == 1.5, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v2(myid*2+1)) == 1.5, ExcInternalError());
// set local values
vb(myid*2)=b;
// check local values
if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
{
- deallog << myid*2 << ":" << PetscRealPart(v(myid*2)) << std::endl;
- deallog << myid*2+1 << ":" << PetscRealPart(v(myid*2+1)) << std::endl;
+ deallog << myid*2 << ":" << get_real_assert_zero_imag(v(myid*2)) << std::endl;
+ deallog << myid*2+1 << ":" << get_real_assert_zero_imag(v(myid*2+1)) << std::endl;
}
- Assert(PetscRealPart(v(myid*2)) == myid*4.0, ExcInternalError());
- Assert(PetscRealPart(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v(myid*2)) == myid*4.0, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError());
// check ghost values
if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
- deallog << "ghost: " << PetscRealPart(v(1)) << std::endl;
- Assert(PetscRealPart(v(1)) == 2.0, ExcInternalError());
+ deallog << "ghost: " << get_real_assert_zero_imag(v(1)) << std::endl;
+ Assert(get_real_assert_zero_imag(v(1)) == 2.0, ExcInternalError());
//assignment from ghosted to ghosted
v2 = v;
- Assert(PetscRealPart(v2(1)) == 2.0, ExcInternalError());
- Assert(PetscRealPart(v2(myid*2)) == myid*4.0, ExcInternalError());
- Assert(PetscRealPart(v2(myid*2+1)) == myid*4.0+2.0, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v2(1)) == 2.0, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v2(myid*2)) == myid*4.0, ExcInternalError());
+ Assert(get_real_assert_zero_imag(v2(myid*2+1)) == myid*4.0+2.0, ExcInternalError());
if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
- deallog << "ghost: " << PetscRealPart(v2(1)) << std::endl;
+ deallog << "ghost: " << get_real_assert_zero_imag(v2(1)) << std::endl;
// done
if (myid==0)
{
unsigned int idx = locally_owned_dofs.nth_index_in_set(i);
//std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
- Assert(idx == PetscRealPart(solution(idx)),ExcInternalError());
+ Assert(idx == get_real_assert_zero_imag(solution(idx)),ExcInternalError());
}
{
unsigned int idx = locally_owned_dofs.nth_index_in_set (i);
//std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
- AssertThrow (idx == PetscRealPart(solution (idx)), ExcInternalError());
- AssertThrow (2*idx == PetscRealPart(solution2 (idx)), ExcInternalError());
+ AssertThrow (idx == get_real_assert_zero_imag(solution (idx)), ExcInternalError());
+ AssertThrow (2*idx == get_real_assert_zero_imag(solution2 (idx)), ExcInternalError());
}
double norm = solution.l1_norm();
{
unsigned int idx = locally_owned_dofs.nth_index_in_set (i);
x (idx) = idx;
- deallog << '[' << idx << ']' << ' ' << PetscRealPart(x(idx)) << std::endl;
+ deallog << '[' << idx << ']' << ' ' << get_real_assert_zero_imag(x(idx)) << std::endl;
}
for (unsigned int i = 0; i < locally_owned_dofs.n_elements(); ++i)
{
unsigned int idx = locally_owned_dofs.nth_index_in_set (i);
- deallog << '[' << idx << ']' << ' ' << PetscRealPart(solution(idx)) << std::endl;
+ deallog << '[' << idx << ']' << ' ' << get_real_assert_zero_imag(solution(idx)) << std::endl;
}
deallog << "#cells = " << tr.n_global_active_cells() << std::endl;
for (unsigned int i=0; i<value.size(); ++i)
{
- tmp[i]=PetscRealPart(value[i]);
+ tmp[i]=get_real_assert_zero_imag(value[i]);
tmpI[i]=PetscImaginaryPart(value[i]);
}
#else
if (Utilities::MPI::this_mpi_process(mpi_communicator)==0)
{
- pcout << point1 << "\t" << PetscRealPart(value1[0]) << std::endl;
+ pcout << point1 << "\t" << get_real_assert_zero_imag(value1[0]) << std::endl;
if (std::abs(value2[0]-value1[0])>1e-8)
{
std::cout<<point1<< "\t" << value1[0] << std::endl;
std::cout<<point2<< "\t" << value2[0] << std::endl;
Assert(false, ExcInternalError());
}
- Assert(std::fabs(PetscImaginaryPart(value1[0]))<1e-10,
- ExcInternalError());
}
}
}
if (Utilities::MPI::this_mpi_process(mpi_communicator)==0)
{
- pcout << point1 << "\t" << PetscRealPart(value1[0]) << std::endl;
+ pcout << point1 << "\t" << get_real_assert_zero_imag(value1[0]) << std::endl;
if (std::abs(value2[0]-value1[0])>1e-8)
{
std::cout<<point1<< "\t" << value1[0] << std::endl;
std::cout<<point2<< "\t" << value2[0] << std::endl;
Assert(false, ExcInternalError());
}
- Assert(std::fabs(PetscImaginaryPart(value1[0]))<1e-10,
- ExcInternalError());
- pcout << point3 << "\t" << PetscRealPart(value3[0]) << std::endl;
+ pcout << point3 << "\t" << get_real_assert_zero_imag(value3[0]) << std::endl;
if (std::abs(value4[0]-value3[0])>1e-8)
{
std::cout<<point3<< "\t" << value3[0] << std::endl;
std::cout<<point4<< "\t" << value4[0] << std::endl;
Assert(false, ExcInternalError());
}
- Assert(std::fabs(PetscImaginaryPart(value3[0]))<1e-10,
- ExcInternalError());
}
}
}
// zero. check this first for the locally owned elements...
for (unsigned int i=0; i<handler.n_dofs(); ++i)
if (locally_owned_dofs.is_element(i))
- AssertThrow (PetscRealPart(vector(i)) == 0,
+ AssertThrow (get_real_assert_zero_imag(vector(i)) == 0,
ExcInternalError());
// ...end then also for the ghost elements
for (unsigned int i=0; i<handler.n_dofs(); ++i)
if (locally_relevant_dofs.is_element(i)
&&
!locally_owned_dofs.is_element(i))
- AssertThrow (PetscRealPart(vector(i)) == 0,
+ AssertThrow (get_real_assert_zero_imag(vector(i)) == 0,
ExcInternalError());
}
}
// verify correctness
if (myid != 0)
- AssertThrow (PetscRealPart(vec(vec.local_range().first+10)) == vec.local_range().first-25,
+ AssertThrow (get_real_assert_zero_imag(vec(vec.local_range().first+10)) == vec.local_range().first-25,
ExcInternalError());
if (myid != n_processes-1)
- AssertThrow (PetscRealPart(vec(vec.local_range().first+90)) == vec.local_range().first+105,
+ AssertThrow (get_real_assert_zero_imag(vec(vec.local_range().first+90)) == vec.local_range().first+105,
ExcInternalError());
for (unsigned int i=vec.local_range().first; i<vec.local_range().second; ++i)
(i != vec.local_range().first+90))
{
PetscScalar val = vec(i);
- AssertThrow (std::fabs(PetscRealPart(val) - i) <= 1e-6, ExcInternalError());
- AssertThrow (std::fabs(PetscImaginaryPart(val)) <= 1e-6, ExcInternalError());
+ AssertThrow (std::fabs(get_real_assert_zero_imag(val) - i) <= 1e-6, ExcInternalError());
}
}
// verify correctness
if (myid != 0)
- AssertThrow (PetscRealPart(vec(vec.block(0).local_range().first+10)) == vec.block(0).local_range().first-25,
+ AssertThrow (get_real_assert_zero_imag(vec(vec.block(0).local_range().first+10)) == vec.block(0).local_range().first-25,
ExcInternalError());
if (myid != n_processes-1)
- AssertThrow (PetscRealPart(vec(vec.block(0).local_range().first+90)) == vec.block(0).local_range().first+105,
+ AssertThrow (get_real_assert_zero_imag(vec(vec.block(0).local_range().first+90)) == vec.block(0).local_range().first+105,
ExcInternalError());
if (myid != 0)
- AssertThrow (PetscRealPart(vec(vec.block(0).size()+vec.block(1).local_range().first+10)) == vec.block(1).local_range().first-25,
+ AssertThrow (get_real_assert_zero_imag(vec(vec.block(0).size()+vec.block(1).local_range().first+10)) == vec.block(1).local_range().first-25,
ExcInternalError());
if (myid != n_processes-1)
- AssertThrow (PetscRealPart(vec(vec.block(0).size()+vec.block(1).local_range().first+90)) == vec.block(1).local_range().first+105,
+ AssertThrow (get_real_assert_zero_imag(vec(vec.block(0).size()+vec.block(1).local_range().first+90)) == vec.block(1).local_range().first+105,
ExcInternalError());
(i != vec.block(0).local_range().first+90))
{
PetscScalar val = vec.block(0)(i);
- AssertThrow (std::fabs(PetscRealPart(val) - i) <= 1e-6, ExcInternalError());
- AssertThrow (PetscImaginaryPart(val) == 0.0, ExcInternalError());
+ AssertThrow (std::fabs(get_real_assert_zero_imag(val) - i) <= 1e-6, ExcInternalError());
}
}
for (unsigned int i=vec.block(1).local_range().first; i<vec.block(1).local_range().second; ++i)
(i != vec.block(1).local_range().first+90))
{
PetscScalar val = vec.block(1)(i);
- AssertThrow (std::fabs(PetscRealPart(val) - i) <= 1e-6, ExcInternalError());
- AssertThrow ( PetscImaginaryPart(val) == 0.0, ExcInternalError());
+ AssertThrow (std::fabs(get_real_assert_zero_imag(val) - i) <= 1e-6, ExcInternalError());
}
}
// verify correctness
if (myid != 0)
- {
- AssertThrow (PetscRealPart(vec(vec.local_range().first+10)) == vec.local_range().first-25+1,
- ExcInternalError());
- AssertThrow (PetscImaginaryPart(vec(vec.local_range().first+10)) == 0.,
- ExcInternalError());
- }
+ AssertThrow (get_real_assert_zero_imag(vec(vec.local_range().first+10)) == vec.local_range().first-25+1,
+ ExcInternalError());
if (myid != n_processes-1)
- {
- AssertThrow (PetscRealPart(vec(vec.local_range().first+90)) == vec.local_range().first+105-1,
- ExcInternalError());
- AssertThrow (PetscImaginaryPart(vec(vec.local_range().first+90)) == 0.,
- ExcInternalError());
- }
+ AssertThrow (get_real_assert_zero_imag(vec(vec.local_range().first+90)) == vec.local_range().first+105-1,
+ ExcInternalError());
for (unsigned int i=vec.local_range().first; i<vec.local_range().second; ++i)
{
(i != vec.local_range().first+90))
{
PetscScalar val = vec(i);
- AssertThrow (std::fabs(PetscRealPart(val) - i) <= 1e-6, ExcInternalError());
- AssertThrow (std::fabs(PetscImaginaryPart(val)) <= 1e-6, ExcInternalError());
+ AssertThrow (std::fabs(get_real_assert_zero_imag(val) - i) <= 1e-6, ExcInternalError());
}
}