Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
6aa1ca3
added adj_search.hpp header in MLSInterpolation.hpp file
abhiyan123 Sep 22, 2024
14f82b2
added regular grid linear interpolator and mls interpolator
abhiyan123 Sep 22, 2024
12a26bb
added interpolator subdirectory
abhiyan123 Sep 22, 2024
a3b97f3
added the interpolator folder with header files for MLS and linear me…
abhiyan123 Sep 22, 2024
e3ac60b
removed hdf5 header
abhiyan123 Sep 23, 2024
ec486e7
removed unnecessary files
abhiyan123 Sep 23, 2024
9ec0f44
Merge pull request #1 from abhiyanpaudel/interpolator
Fuad-HH Sep 24, 2024
749be28
enforce number of support
Fuad-HH Sep 24, 2024
cca0eca
can use any dimension and degree of polynomial
abhiyan123 Sep 24, 2024
418fb08
Merge branch 'mls_generalMLS' into general_mls
abhiyan123 Sep 24, 2024
1ddc29c
added test cases
abhiyan123 Sep 24, 2024
eda1048
moved interpolator folder to pcms
abhiyan123 Oct 10, 2024
b90cbaf
modified to incorporate interpolator
abhiyan123 Oct 10, 2024
5cd5869
updated the file
abhiyan123 Oct 10, 2024
92d0183
deleted unneceesary files
abhiyan123 Oct 10, 2024
5b72727
variable radius for degas2
Fuad-HH Oct 21, 2024
1bc767b
cleaned up the basis monomial calculation
abhiyan123 Oct 21, 2024
c052240
made it general
abhiyan123 Oct 21, 2024
8319c3d
updated the test cases that verifies the monomial basis calculations
abhiyan123 Oct 21, 2024
b9537dc
added unit test case that verifies the basis calculation
abhiyan123 Oct 21, 2024
174cf92
updated .gitignore file
abhiyan123 Oct 21, 2024
b65cee8
made changes to accomodate general mls procedure
abhiyan123 Oct 25, 2024
7021f91
compatible with the generalized mls
abhiyan123 Oct 28, 2024
723bcdf
added test case file name
abhiyan123 Oct 28, 2024
d5bd614
created the test case for generalized mls
abhiyan123 Oct 28, 2024
a14cf7d
merge general order interpolation changes from abhiyan's fork
Fuad-HH Oct 28, 2024
810b760
move include adj_search_dega2.hpp from MLSInterpolation.hpp to test_r…
Fuad-HH Oct 29, 2024
5609874
radius adaptation for adj_search
Fuad-HH Oct 29, 2024
f337543
added Nan Check
abhiyan123 Oct 29, 2024
726e6ff
formatted the files
abhiyan123 Oct 29, 2024
0b3b202
Merge pull request #7 from abhiyanpaudel/general_mls
Fuad-HH Oct 29, 2024
a7b5e33
revert clangformatting in CMakeLists.txt and remove const from suppor…
Fuad-HH Oct 29, 2024
1f60fe1
merge centroid->node interp with general
Fuad-HH Oct 31, 2024
a2b1563
refactor
Fuad-HH Nov 1, 2024
8e6873a
radius adaptation option added for cell2node search
Fuad-HH Nov 1, 2024
4c93f4a
renamed test sections
abhiyan123 Nov 11, 2024
cd88d53
interface for passing various rbf functions
abhiyan123 Nov 18, 2024
5acab5e
updated the CMake list to include the new files
abhiyan123 Nov 18, 2024
cc8e3d8
changes to accomodate interface
abhiyan123 Nov 18, 2024
ec57a6d
changes to accomodate interface
abhiyan123 Nov 18, 2024
c888f28
updated test CMake list
abhiyan123 Nov 18, 2024
27453c6
added pcms_interpolator target
abhiyan123 Dec 3, 2024
f9bd120
set target properties for pcms_interpolator
abhiyan123 Dec 3, 2024
2ba0322
updated with kokkos kernels LU solver
abhiyan123 Dec 3, 2024
52dc62a
upgraded to kokkos kernels
abhiyan123 Dec 3, 2024
10f0b51
add radial basis function choices for user
abhiyan123 Dec 3, 2024
8e8e7fb
added and updated test cases
abhiyan123 Dec 3, 2024
cf60f99
Merge pull request #14 from abhiyanpaudel/general_mls
Fuad-HH Dec 5, 2024
b1cfb1f
Merge branch develop into mls_interpolation
jacobmerson Dec 18, 2024
90b5218
make functions inline to compile
jacobmerson Dec 18, 2024
4b3cbe1
removed target_include_directories
abhiyan123 Jan 21, 2025
ab71480
added comments and kokkoskernel dot product function
abhiyan123 Jan 21, 2025
f5e55c3
added comments
abhiyan123 Jan 21, 2025
90bff10
consistent naming of the class
abhiyan123 Jan 21, 2025
799ff6d
updated to consistent naming of the class
abhiyan123 Jan 21, 2025
e63e3af
changed the matrix name from A to P for consistency
abhiyan123 Jan 21, 2025
d5ae099
updates
abhiyan123 Jan 21, 2025
7e7b2c1
merged
abhiyan123 Jan 21, 2025
c3385bd
Merge branch 'develop' into mls_interpolation
cwsmith Jan 29, 2025
9a73bd3
deleted files
abhiyan123 Jan 31, 2025
c226a24
remove deleted files
abhiyan123 Jan 31, 2025
d00e046
move implementation details
abhiyan123 Jan 31, 2025
3828ec2
introduce new aliases
abhiyan123 Jan 31, 2025
435b1e1
update mls interpolation test cases
abhiyan123 Jan 31, 2025
123ecd4
Merge branch 'mls_interpolation' of github.com:SCOREC/pcms into mls_i…
abhiyan123 Jan 31, 2025
73bbd2a
make SupportResults struct readonly (#156)
cwsmith Feb 11, 2025
b6e01f2
remove ] file
cwsmith Feb 11, 2025
5281675
use league_rank as loop control var
cwsmith Feb 11, 2025
6a089c4
Merge pull request #157 from SCOREC/cws/mlsInterpLeagueVar2
jacobmerson Feb 12, 2025
89812a4
change i to league_rank
abhiyan123 Feb 13, 2025
651682d
remove radii2
abhiyan123 Feb 13, 2025
2693551
remove radii2 from struct
abhiyan123 Feb 13, 2025
48140e7
add radii2
abhiyan123 Feb 13, 2025
529832f
remove radii2
abhiyan123 Feb 13, 2025
0f8e606
remove redundant mls_interpolation overload
abhiyan123 Feb 13, 2025
e5b30cd
update mls_interpolation parameters
abhiyan123 Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*.swp
.spack-env
*.bak
.nfs*
1 change: 1 addition & 0 deletions config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ if(@PCMS_ENABLE_Fortran@)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/pcms-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/pcms_interpolator-targets.cmake")
# must be called at the end of the config file
check_required_components(pcms)
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ if(PCMS_ENABLE_Fortran)
target_link_libraries(pcms_pcms INTERFACE pcms::fortranapi)
endif()


add_subdirectory(pcms/interpolator)

install(
TARGETS pcms_pcms
EXPORT pcms-targets
Expand Down
8 changes: 5 additions & 3 deletions src/pcms/assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
#include "pcms/print.h"
#include <cstdio>
#include <cstdlib>
namespace pcms {
void Pcms_Assert_Fail(const char* msg) {
namespace pcms
{
void Pcms_Assert_Fail(const char* msg)
{
printError("%s", msg);
abort();
}
}
} // namespace pcms
17 changes: 8 additions & 9 deletions src/pcms/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
snprintf(omsg, 2048, "%s failed at %s + %d on rank %d\n", #cond, \
__FILE__, __LINE__, rank); \
pcms::Pcms_Assert_Fail(omsg); \
} \
} while (0)


namespace pcms {
//from scorec/core/pcu_fail.h
void Pcms_Assert_Fail(const char* msg) __attribute__ ((noreturn));
}

} \
} while (0)

namespace pcms
{
// from scorec/core/pcu_fail.h
void Pcms_Assert_Fail(const char* msg) __attribute__((noreturn));
} // namespace pcms

#endif // PCMS_COUPLING_ASSERT_H
117 changes: 65 additions & 52 deletions src/pcms/capi/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ namespace pcms
using FieldAdapterVariant =
std::variant<std::monostate, pcms::XGCFieldAdapter<double>,
pcms::XGCFieldAdapter<float>, pcms::XGCFieldAdapter<int>,
pcms::XGCFieldAdapter<long>,
pcms::DummyFieldAdapter
//#ifdef PCMS_HAS_OMEGA_H
// ,
// pcms::OmegaHFieldAdapter<double>,
// pcms::OmegaHFieldAdapter<int>
//#endif
pcms::XGCFieldAdapter<long>, pcms::DummyFieldAdapter
// #ifdef PCMS_HAS_OMEGA_H
// ,
// pcms::OmegaHFieldAdapter<double>,
// pcms::OmegaHFieldAdapter<int>
// #endif
>;

} // namespace pcms

[[nodiscard]] PcmsClientHandle pcms_create_client(const char* name,
MPI_Comm comm)
MPI_Comm comm)
{
auto* client = new pcms::CouplerClient(name, comm);
return {reinterpret_cast<void*>(client)};
Expand All @@ -41,55 +40,61 @@ void pcms_destroy_client(PcmsClientHandle client)
PcmsReverseClassificationHandle pcms_load_reverse_classification(
const char* file, MPI_Comm comm)
{
//std::filesystem::path filepath{file};
// std::filesystem::path filepath{file};
auto* rc = new pcms::ReverseClassificationVertex{
pcms::ReadReverseClassificationVertex(file, comm)};
return {reinterpret_cast<void*>(rc)};
}
void pcms_destroy_reverse_classification(
PcmsReverseClassificationHandle rc)
void pcms_destroy_reverse_classification(PcmsReverseClassificationHandle rc)
{
if (rc.pointer != nullptr)
delete reinterpret_cast<pcms::ReverseClassificationVertex*>(rc.pointer);
}
struct AddFieldVariantOperators {
AddFieldVariantOperators(const char* name, pcms::CouplerClient* client, int participates)
: name_(name), client_(client), participates_(participates)
struct AddFieldVariantOperators
{
AddFieldVariantOperators(const char* name, pcms::CouplerClient* client,
int participates)
: name_(name), client_(client), participates_(participates)
{
}

[[nodiscard]]
pcms::CoupledField* operator()(const std::monostate&) const noexcept { return nullptr; }
pcms::CoupledField* operator()(const std::monostate&) const noexcept
{
return nullptr;
}
template <typename FieldAdapter>
[[nodiscard]]
pcms::CoupledField* operator()(const FieldAdapter& field_adapter) const noexcept {
return client_->AddField(name_, field_adapter, participates_);
pcms::CoupledField* operator()(
const FieldAdapter& field_adapter) const noexcept
{
return client_->AddField(name_, field_adapter, participates_);
}

const char* name_;
pcms::CouplerClient* client_;
bool participates_;
};

PcmsFieldHandle pcms_add_field(PcmsClientHandle client_handle,
const char* name,
PcmsFieldAdapterHandle adapter_handle,
int participates)
PcmsFieldHandle pcms_add_field(PcmsClientHandle client_handle, const char* name,
PcmsFieldAdapterHandle adapter_handle,
int participates)
{

auto* adapter =
reinterpret_cast<pcms::FieldAdapterVariant*>(adapter_handle.pointer);
auto* client = reinterpret_cast<pcms::CouplerClient*>(client_handle.pointer);
PCMS_ALWAYS_ASSERT(client != nullptr);
PCMS_ALWAYS_ASSERT(adapter != nullptr);
//pcms::CoupledField* field = std::visit(
// redev::overloaded{
// [](const std::monostate&) -> pcms::CoupledField* { return nullptr; },
// [&name, &client, participates](const auto& field_adapter) {
// return client->AddField(name, field_adapter, participates);
// }},
// *adapter);
pcms::CoupledField* field = std::visit(AddFieldVariantOperators{name, client, participates},*adapter);
// pcms::CoupledField* field = std::visit(
// redev::overloaded{
// [](const std::monostate&) -> pcms::CoupledField* { return nullptr; },
// [&name, &client, participates](const auto& field_adapter) {
// return client->AddField(name, field_adapter, participates);
// }},
// *adapter);
pcms::CoupledField* field =
std::visit(AddFieldVariantOperators{name, client, participates}, *adapter);
return {reinterpret_cast<void*>(field)};
}
void pcms_send_field_name(PcmsClientHandle client_handle, const char* name)
Expand All @@ -98,8 +103,7 @@ void pcms_send_field_name(PcmsClientHandle client_handle, const char* name)
PCMS_ALWAYS_ASSERT(client != nullptr);
client->SendField(name);
}
void pcms_receive_field_name(PcmsClientHandle client_handle,
const char* name)
void pcms_receive_field_name(PcmsClientHandle client_handle, const char* name)
{
auto* client = reinterpret_cast<pcms::CouplerClient*>(client_handle.pointer);
PCMS_ALWAYS_ASSERT(client != nullptr);
Expand All @@ -123,7 +127,7 @@ void pcms_create_xgc_field_adapter_t(
const pcms::ReverseClassificationVertex& reverse_classification,
in_overlap_function in_overlap, pcms::FieldAdapterVariant& field_adapter)
{
PCMS_ALWAYS_ASSERT((size >0) ? (data!=nullptr) : true);
PCMS_ALWAYS_ASSERT((size > 0) ? (data != nullptr) : true);
pcms::ScalarArrayView<T, pcms::HostMemorySpace> data_view(
reinterpret_cast<T*>(data), size);
field_adapter.emplace<pcms::XGCFieldAdapter<T>>(
Expand All @@ -140,29 +144,35 @@ PcmsFieldAdapterHandle pcms_create_xgc_field_adapter(
PCMS_ALWAYS_ASSERT(reverse_classification != nullptr);
switch (data_type) {
case PCMS_DOUBLE:
pcms_create_xgc_field_adapter_t<double>(
name, comm, data, size, *reverse_classification, in_overlap, *field_adapter);
pcms_create_xgc_field_adapter_t<double>(name, comm, data, size,
*reverse_classification,
in_overlap, *field_adapter);
break;
case PCMS_FLOAT:
pcms_create_xgc_field_adapter_t<float>(
name, comm, data, size, *reverse_classification, in_overlap, *field_adapter);
pcms_create_xgc_field_adapter_t<float>(name, comm, data, size,
*reverse_classification,
in_overlap, *field_adapter);
break;
case PCMS_INT:
pcms_create_xgc_field_adapter_t<int>(
name, comm, data, size, *reverse_classification, in_overlap, *field_adapter);
pcms_create_xgc_field_adapter_t<int>(name, comm, data, size,
*reverse_classification, in_overlap,
*field_adapter);
break;
case PCMS_LONG_INT:
pcms_create_xgc_field_adapter_t<long int>(
name, comm, data, size, *reverse_classification, in_overlap, *field_adapter);
pcms_create_xgc_field_adapter_t<long int>(name, comm, data, size,
*reverse_classification,
in_overlap, *field_adapter);
break;
default:
pcms::printError("tyring to create XGC adapter with invalid type!\n");
std::abort();
}
return {reinterpret_cast<void*>(field_adapter)};
}
PcmsFieldAdapterHandle pcms_create_dummy_field_adapter() {
auto* field_adapter = new pcms::FieldAdapterVariant{pcms::DummyFieldAdapter{}};
PcmsFieldAdapterHandle pcms_create_dummy_field_adapter()
{
auto* field_adapter =
new pcms::FieldAdapterVariant{pcms::DummyFieldAdapter{}};
return {reinterpret_cast<void*>(field_adapter)};
}

Expand All @@ -175,8 +185,7 @@ void pcms_destroy_field_adapter(PcmsFieldAdapterHandle adapter_handle)
adapter = nullptr;
}
}
int pcms_reverse_classification_count_verts(
PcmsReverseClassificationHandle rc)
int pcms_reverse_classification_count_verts(PcmsReverseClassificationHandle rc)
{
auto* reverse_classification =
reinterpret_cast<const pcms::ReverseClassificationVertex*>(rc.pointer);
Expand All @@ -187,23 +196,27 @@ int pcms_reverse_classification_count_verts(
return current + verts.second.size();
});
}
void pcms_begin_send_phase(PcmsClientHandle h) {
void pcms_begin_send_phase(PcmsClientHandle h)
{
auto* client = reinterpret_cast<pcms::CouplerClient*>(h.pointer);
PCMS_ALWAYS_ASSERT(client != nullptr);
client ->BeginSendPhase();
client->BeginSendPhase();
}
void pcms_end_send_phase(PcmsClientHandle h) {
void pcms_end_send_phase(PcmsClientHandle h)
{
auto* client = reinterpret_cast<pcms::CouplerClient*>(h.pointer);
PCMS_ALWAYS_ASSERT(client != nullptr);
client ->EndSendPhase();
client->EndSendPhase();
}
void pcms_begin_receive_phase(PcmsClientHandle h ) {
void pcms_begin_receive_phase(PcmsClientHandle h)
{
auto* client = reinterpret_cast<pcms::CouplerClient*>(h.pointer);
PCMS_ALWAYS_ASSERT(client != nullptr);
client ->BeginReceivePhase();
client->BeginReceivePhase();
}
void pcms_end_receive_phase(PcmsClientHandle h) {
void pcms_end_receive_phase(PcmsClientHandle h)
{
auto* client = reinterpret_cast<pcms::CouplerClient*>(h.pointer);
PCMS_ALWAYS_ASSERT(client != nullptr);
client ->EndReceivePhase();
client->EndReceivePhase();
}
42 changes: 28 additions & 14 deletions src/pcms/capi/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,30 @@
extern "C" {
#endif

struct PcmsClientHandle { void* pointer; };
struct PcmsClientHandle
{
void* pointer;
};
typedef struct PcmsClientHandle PcmsClientHandle;
struct PcmsOmegaHMeshHandle { void* pointer; };
struct PcmsOmegaHMeshHandle
{
void* pointer;
};
typedef struct PcmsOmegaHMeshHandle PcmsOmegaHMeshHandle;
struct PcmsReverseClassificationHandle { void* pointer; };
struct PcmsReverseClassificationHandle
{
void* pointer;
};
typedef struct PcmsReverseClassificationHandle PcmsReverseClassificationHandle;
struct PcmsFieldAdapterHandle { void* pointer; };
struct PcmsFieldAdapterHandle
{
void* pointer;
};
typedef struct PcmsFieldAdapterHandle PcmsFieldAdapterHandle;
struct PcmsFieldHandle { void* pointer; };
struct PcmsFieldHandle
{
void* pointer;
};
typedef struct PcmsFieldHandle PcmsFieldHandle;

enum PcmsAdapterType
Expand All @@ -35,7 +50,7 @@ enum PcmsType
};
typedef enum PcmsType PcmsType;

//change to a struct holding a pointer
// change to a struct holding a pointer
PcmsClientHandle pcms_create_client(const char* name, MPI_Comm comm);
void pcms_destroy_client(PcmsClientHandle);

Expand All @@ -47,24 +62,23 @@ void pcms_destroy_reverse_classification(PcmsReverseClassificationHandle);
// this function is helpful for test cases so we can compute the total number of
// vertexes in the mesh without reading additional files. This function is not
// likely to be needed for production cases
int pcms_reverse_classification_count_verts(
PcmsReverseClassificationHandle);
int pcms_reverse_classification_count_verts(PcmsReverseClassificationHandle);

// takes in overlap function takes a geometric dimension and a geometric id
// C doesn't have a builtin bool type, so we use int for compatability with C++
typedef int8_t (*in_overlap_function)(int, int);
PcmsFieldAdapterHandle pcms_create_xgc_field_adapter(
const char* name, MPI_Comm plane_comm, void* data, int size, PcmsType data_type,
const PcmsReverseClassificationHandle rc, in_overlap_function in_overlap);
const char* name, MPI_Comm plane_comm, void* data, int size,
PcmsType data_type, const PcmsReverseClassificationHandle rc,
in_overlap_function in_overlap);

PcmsFieldAdapterHandle pcms_create_dummy_field_adapter();

void pcms_destroy_field_adapter(PcmsFieldAdapterHandle);

PcmsFieldHandle pcms_add_field(PcmsClientHandle client_handle,
const char* name,
PcmsFieldAdapterHandle adapter_handle,
int participates);
PcmsFieldHandle pcms_add_field(PcmsClientHandle client_handle, const char* name,
PcmsFieldAdapterHandle adapter_handle,
int participates);
void pcms_send_field_name(PcmsClientHandle, const char* name);
void pcms_receive_field_name(PcmsClientHandle, const char* name);

Expand Down
5 changes: 1 addition & 4 deletions src/pcms/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "pcms/field_communicator.h"
#include "pcms/profile.h"


namespace pcms
{

Expand All @@ -19,7 +18,7 @@ class CoupledField
PCMS_FUNCTION_TIMER;
MPI_Comm mpi_comm_subset = MPI_COMM_NULL;
PCMS_ALWAYS_ASSERT((mpi_comm == MPI_COMM_NULL) ? (participates == false)
: true);
: true);
if (mpi_comm != MPI_COMM_NULL) {
int rank = -1;
MPI_Comm_rank(mpi_comm, &rank);
Expand Down Expand Up @@ -89,8 +88,6 @@ class CoupledField
std::unique_ptr<CoupledFieldConcept> coupled_field_;
};



class CouplerClient
{
public:
Expand Down
Loading