00001 #ifndef LAS_PETSC_INTF_HPP
00002 #define LAS_PETSC_INTF_HPP
00003
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <string.h>
00007 #include <math.h>
00008 #include "../../lsd_mkb/amg_ext/amg_ext.h"
00009 #include "AMGSolverStructure.hpp"
00010 #include "ResidualBasedErrorEvaluator.hpp"
00011 #include "KnownSolutionErrorEvaluator.hpp"
00012 extern "C"{
00013 #include "GhostBlockExchanger.h"
00014 }
00015
00016
00017 struct AMGSolverData{
00018 Mat A;
00019 Vec b;
00020 AMGSolverStructure* solver;
00021 int* posglobs;
00022 struct AMGAlgorithmData amgInitData;
00023 };
00024
00025 extern struct AMGAlgorithmData amg_algorithm_data;
00026 extern struct AMGSolverData amg_solver_data;
00027
00028 extern "C" {
00029 void amg_project_solution_to_level(int level_id);
00030
00031 void amg_project_solution_from_level(int level_id);
00032 }
00033
00034 extern "C" int lar_petsc_allocate_SM_and_LV(
00035 int Max_SM_size,
00036 int Nrblocks,
00037 int Nrdof_glob,
00038 int* Nrdofbl,
00039 int* Posglob,
00040 int* Nroffbl,
00041
00042 int** L_offbl
00043 );
00044
00045 extern "C" int lar_petsc_initialize_SM_and_LV(int Matrix_id, int Comp_type);
00046
00047
00048
00049
00050
00051
00052 extern "C" int lar_petsc_assemble_SM_and_LV(
00053
00054 int Matrix_id,
00055 int Comp_type,
00056
00057
00058 int Nr_dof_bl,
00059
00060 int* L_bl_id,
00061 int* L_bl_nrdof,
00062 double* Stiff_mat,
00063 double* Rhs_vect,
00064 char* Rewr_dofs
00065
00066
00067 );
00068
00069 extern "C" int lar_petsc_fill_preconditioner(int Matrix_id);
00070
00071 extern "C" int lar_petsc_free_SM_and_LV(int Matrix_id);
00072
00073 extern "C" void lar_petsc_perform_BJ_or_GS_iterations(
00074 int Matrix_id,
00075 int Use_rhs,
00076 int Ini_zero,
00077 int Nr_prec,
00078 int Ndof,
00079 double* V,
00080
00081 double* B
00082
00083 );
00084 #endif