    

 ## On this page

  

 

 # Standalone mapping

 Last update: 17.07.2025 

## Steps to perform mapping

This section describes the mapping workflow. It also provides simple APIs implementation examples, so it can be used to familiarize with the basic participant library API concepts. The details of the mapping algorithms can be found in the System Coupling User's Guide.

The steps involved in setting up and executing mapping of data are shown in Figure 1 and described in more details below.

![](/sites/default/files/migrate-content/system_coupling_cpp_library_2024_r2/ParticipantStepsInMapping.png "Figure 1: Sequence of steps to execute mapping")  
*Figure 1: Sequence of steps to execute mapping*

The steps are described in more detail below. A couple of code examples for each target language is provided at the end of this section.

### Step 1: Start

Start by initializing the participant library in standalone mode.

If using C++ or Python languages, this step involves instantiating the `SystemCoupling` class (there can only be a single instance of this class at a time).

If using C or Fortran languages, in most cases nothing needs to be done for this step. The only exception is when a) running in parallel using one of the supported MPI versions and b) implementing the APIs on a subset of all parallel processes. In this case, start by calling `syscStartStandaloneParallel` function in C or `syscStartStandaloneF` function in Fortran and by passing the desired MPI communicator into those functions. See [Execution in a Parallel Environment](md_09__ParallelExecution.xhtml) for more details.

### Step 2: Set up mapping

Create and register variables, regions and coupling interfaces.

### Step 3: Register heavyweight data access

In this step, the callback functions to access the participant's mesh and solution data must be registered. See [Access to Heavyweight Data](md_11__HeavyweightDataAccess.xhtml) for more details.

### Step 4: Update inputs

During this step, mapping will be performed, and inputs (target values) will be brought up-to-date. The latest output (source) values on the source side of the interface will be used to fill the inputs.

Inputs update can be performed multiple times. If the source values change, this will be reflected in the target values.

## Mapping examples

Sample code is provided, demonstrating the use of the participant library APIs to perform mapping.

- Surface mapping example
- Volume mapping example

For information on how to compile the code in these examples, see [Compiling, linking, and executing applications that use the Participant library](md_17__CompilingLinkingExecuting.xhtml).

### Surface mapping example

In this example, the solution data is mapped between two surface regions. The mesh in each region consists of a single (unit square) quadrilateral element. The variable to be transferred from source to target is a scalar defined on elements. The variable is set to be extensive, although the choice of whether the variable is extensive or intensive is insignificant here, since the meshes are conformal.

The value on the source element is set to `33.3`. Since the meshes are identical on source and target, the expected result of mapping is that the target value also becomes `33.3`.

Figure 2 illustrates the problem setup.

![](/sites/default/files/migrate-content/system_coupling_cpp_library_2024_r2/SimpleMappingExample.png "Figure 2: Simple surface mapping example")  
*Figure 2: Simple surface mapping example*

#### C++

\#include "SystemCouplingParticipant/SystemCoupling.hpp"

\#include &lt;vector&gt;

\#include &lt;iostream&gt;

 

// Mesh and solution data arrays.

std::vector&lt;double&gt; nodeCoordsSrc = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0};

std::vector&lt;int&gt; elemNodeCountsSrc = {4};

std::vector&lt;int&gt; elemNodeIdsSrc = {1, 2, 3, 4};

 

std::vector&lt;double&gt; nodeCoordsTrg = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0};

std::vector&lt;int&gt; elemNodeCountsTrg = {4};

std::vector&lt;int&gt; elemNodeIdsTrg = {5, 6, 7, 8};

 

std::vector&lt;double&gt; elemDataSrc = {33.3};

std::vector&lt;double&gt; elemDataTrg = {0};

 

// Data access function to get mesh.

[sysc::SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml) getSurfaceMesh(const std::string&amp; regionName)

{

 if (regionName == "source") {

 return [sysc::SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(

 [sysc::NodeData](structsysc_1_1NodeData.xhtml)(nodeCoordsSrc),

 [sysc::ElementNodeCountData](structsysc_1_1ElementNodeCountData.xhtml)(elemNodeCountsSrc),

 [sysc::ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(elemNodeIdsSrc));

 }

 else {

 return [sysc::SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(

 [sysc::NodeData](structsysc_1_1NodeData.xhtml)(nodeCoordsTrg),

 [sysc::ElementNodeCountData](structsysc_1_1ElementNodeCountData.xhtml)(elemNodeCountsTrg),

 [sysc::ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(elemNodeIdsTrg));

 }

}

 

// Data access function to get input scalar data.

[sysc::InputScalarData](classsysc_1_1InputScalarData.xhtml) getInputScalar(

 const std::string&amp; regionName, const std::string&amp; variableName)

{

 return [sysc::InputScalarData](classsysc_1_1InputScalarData.xhtml)(elemDataTrg);

}

 

// Data access function to get output scalar data.

[sysc::OutputScalarData](classsysc_1_1OutputScalarData.xhtml) getOutputScalar(

 const std::string&amp; regionName, const std::string&amp; variableName)

{

 return [sysc::OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemDataSrc);

}

 

// Main function.

int main(int argc, char* argv[])

{

 // Start.

 [sysc::SystemCoupling](classsysc_1_1SystemCoupling.xhtml) sc;

 

 // Setup mapping.

 [sysc::Variable](classsysc_1_1Variable.xhtml) variable("variable", sysc::Scalar, true, sysc::Element);

 [sysc::Region](classsysc_1_1Region.xhtml) sourceRegion("source", sysc::Surface);

 [sysc::Region](classsysc_1_1Region.xhtml) targetRegion("target", sysc::Surface);

 [sysc::CouplingInterface](classsysc_1_1CouplingInterface.xhtml) couplingInterface("interface");

 

 sourceRegion.addOutputVariable(variable);

 targetRegion.addInputVariable(variable);

 couplingInterface.addSideOneRegion(sourceRegion);

 couplingInterface.addSideTwoRegion(targetRegion);

 sc.[addCouplingInterface](classsysc_1_1SystemCoupling.xhtml#ae4c93f4502c9df950fddddab3aab5eec)(couplingInterface);

 

 // Heavyweight data access registration.

 sc.[registerSurfaceMeshAccess](classsysc_1_1SystemCoupling.xhtml#afb819aa4b19aa15dc552d73803352fb4)(&amp;getSurfaceMesh);

 sc.[registerInputScalarDataAccess](classsysc_1_1SystemCoupling.xhtml#a60439772708be217b06f07f8554d5abd)(&amp;getInputScalar);

 sc.[registerOutputScalarDataAccess](classsysc_1_1SystemCoupling.xhtml#adeacbc3dfb240c3f389d344337839458)(&amp;getOutputScalar);

 

 std::cout &lt;&lt; "Target value before mapping: " &lt;&lt; elemDataTrg[0] &lt;&lt; '\\n';

 

 // Inputs update.

 sc.[updateInputs](classsysc_1_1SystemCoupling.xhtml#a9c768f6965f14e8ab3308c7df4144da7)();

 

 std::cout &lt;&lt; "Target value after mapping: " &lt;&lt; elemDataTrg[0] &lt;&lt; '\\n';

 

 return 0;

}

[sysc::CouplingInterface](classsysc_1_1CouplingInterface.xhtml)

Provide a class for a coupling interface.

**Definition** [CouplingInterface.hpp:28](CouplingInterface_8hpp_source.xhtml#l00028)



[sysc::InputScalarData](classsysc_1_1InputScalarData.xhtml)

Provide a class for input scalar data.

**Definition** [InputScalarData.hpp:23](InputScalarData_8hpp_source.xhtml#l00023)



[sysc::OutputScalarData](classsysc_1_1OutputScalarData.xhtml)

Provide a class for output scalar data.

**Definition** [OutputScalarData.hpp:24](OutputScalarData_8hpp_source.xhtml#l00024)



[sysc::Region](classsysc_1_1Region.xhtml)

Provide a class for a System Coupling region.

**Definition** [Region.hpp:30](Region_8hpp_source.xhtml#l00030)



[sysc::SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)

Provide a surface mesh access class.

**Definition** [SurfaceMesh.hpp:27](SurfaceMesh_8hpp_source.xhtml#l00027)



[sysc::SystemCoupling](classsysc_1_1SystemCoupling.xhtml)

Provide the main class for interacting with the System Coupling participant library.

**Definition** [SystemCoupling.hpp:45](SystemCoupling_8hpp_source.xhtml#l00045)



[sysc::SystemCoupling::registerInputScalarDataAccess](classsysc_1_1SystemCoupling.xhtml#a60439772708be217b06f07f8554d5abd)

void registerInputScalarDataAccess(InputScalarDataAccess *dataAccess)

Provide a function to register input scalar data access.



[sysc::SystemCoupling::updateInputs](classsysc_1_1SystemCoupling.xhtml#a9c768f6965f14e8ab3308c7df4144da7)

void updateInputs()

Provide a function to update the participants input variables.



[sysc::SystemCoupling::registerOutputScalarDataAccess](classsysc_1_1SystemCoupling.xhtml#adeacbc3dfb240c3f389d344337839458)

void registerOutputScalarDataAccess(OutputScalarDataAccess *dataAccess)

Provide a function to register output scalar data access.



[sysc::SystemCoupling::addCouplingInterface](classsysc_1_1SystemCoupling.xhtml#ae4c93f4502c9df950fddddab3aab5eec)

void addCouplingInterface(const CouplingInterface &amp;couplingInterface)

Provide a function to add a coupling interface.



[sysc::SystemCoupling::registerSurfaceMeshAccess](classsysc_1_1SystemCoupling.xhtml#afb819aa4b19aa15dc552d73803352fb4)

void registerSurfaceMeshAccess(SurfaceMeshAccess *meshAccess)

Provide a function to register surface mesh access.



[sysc::Variable](classsysc_1_1Variable.xhtml)

Provide a class for a System Coupling variable.

**Definition** [Variable.hpp:21](Variable_8hpp_source.xhtml#l00021)



[sysc::ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)

Describes element-to-node connectivity.

**Definition** [MeshDefinition.hpp:110](MeshDefinition_8hpp_source.xhtml#l00110)



[sysc::ElementNodeCountData](structsysc_1_1ElementNodeCountData.xhtml)

Describes element node counts.

**Definition** [MeshDefinition.hpp:83](MeshDefinition_8hpp_source.xhtml#l00083)



[sysc::NodeData](structsysc_1_1NodeData.xhtml)

Node data access struct, provides read-only access to the mesh nodes.

**Definition** [MeshDefinition.hpp:194](MeshDefinition_8hpp_source.xhtml#l00194)





If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

// third component with value of 0 can be remove from nodeCoord vector

std::vector&lt;double&gt; nodeCoordsSrc = {0, 0, 1, 0, 1, 1, 0, 1};

std::vector&lt;double&gt; nodeCoordsTrg = {0, 0, 1, 0, 1, 1, 0, 1};

 

[sysc::SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml) getSurfaceMesh(const std::string&amp; regionName)

{

 if (regionName == "source") {

 return [sysc::SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(

 //dimension must be supplied with Dimension::D2 value

 [sysc::NodeData](structsysc_1_1NodeData.xhtml)(nodeCoordsSrc,sysc::Dimension::D2),

 [sysc::ElementNodeCountData](structsysc_1_1ElementNodeCountData.xhtml)(elemNodeCountsSrc),

 [sysc::ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(elemNodeIdsSrc));

 }

 else {

 return [sysc::SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(

 [sysc::NodeData](structsysc_1_1NodeData.xhtml)(nodeCoordsTrg,sysc::Dimension::D2),

 [sysc::ElementNodeCountData](structsysc_1_1ElementNodeCountData.xhtml)(elemNodeCountsTrg),

 [sysc::ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(elemNodeIdsTrg));

 }

}

//the rest of the code stays unchanged



#### C

\#include "SystemCouplingParticipant/syscSystemCoupling.h"

 

\#include &lt;stdio.h&gt;

\#include &lt;stdlib.h&gt;

\#include &lt;string.h&gt;

 

/\* Mesh and solution data arrays. \*/

double nodeCoordsSrc[] = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0};

int elemNodeCountsSrc[] = {4};

int elemNodeIdsSrc[] = {1, 2, 3, 4};

 

double nodeCoordsTrg[] = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0};

int elemNodeCountsTrg[] = {4};

int elemNodeIdsTrg[] = {5, 6, 7, 8};

 

size\_t numNodes = 4;

size\_t numElems = 1;

size\_t numElemNodeIds = 4;

 

double elemDataSrc[] = {33.3};

double elemDataTrg[] = {0};

 

/\* Data access function to get mesh. \*/

SyscSurfaceMesh getSurfaceMesh(const char* regionName)

{

 if (strcmp(regionName, "source") == 0) {

 SyscOutputVectorData nodeCoordsData = syscGetOutputVectorDataCompactDouble(

 &amp;nodeCoordsSrc[0], numNodes);

 SyscOutputIntegerData elemNodeCountsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeCountsSrc[0], numElems);

 SyscOutputIntegerData elemNodeIdsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeIdsSrc[0], numElemNodeIds);

 return syscGetSurfaceMeshNCI(

 syscGetNodeDataC(nodeCoordsData),

 syscGetElementNodeCountData(elemNodeCountsData),

 syscGetElementNodeConnectivityData(elemNodeIdsData));

 }

 else {

 SyscOutputVectorData nodeCoordsData = syscGetOutputVectorDataCompactDouble(

 &amp;nodeCoordsTrg[0], numNodes);

 SyscOutputIntegerData elemNodeCountsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeCountsTrg[0], numElems);

 SyscOutputIntegerData elemNodeIdsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeIdsTrg[0], numElemNodeIds);

 return syscGetSurfaceMeshNCI(

 syscGetNodeDataC(nodeCoordsData),

 syscGetElementNodeCountData(elemNodeCountsData),

 syscGetElementNodeConnectivityData(elemNodeIdsData));

 }

}

 

/\* Data access function to get input scalar data. \*/

SyscInputScalarData getInputScalar(

 const char* regionName, const char* variableName)

{

 return syscGetInputScalarDataDouble(&amp;elemDataTrg[0], numElems);

}

 

/\* Data access function to get input scalar data. \*/

SyscOutputScalarData getOutputScalar(

 const char* regionName, const char* variableName)

{

 return syscGetOutputScalarDataDouble(&amp;elemDataSrc[0], numElems);

}

 

/\* Main function. \*/

int main(int argc, char* argv[])

{

 /\* Setup mapping. \*/

 SyscVariable variable = syscGetVariableTE("variable", SyscScalar, 1, SyscElement);

 SyscRegion sourceRegion = syscGetRegionT("source", SyscSurface);

 SyscRegion targetRegion = syscGetRegionT("target", SyscSurface);

 SyscCouplingInterface couplingInterface = syscGetCouplingInterface("interface");

 

 syscAddOutputVariable(sourceRegion, variable);

 syscAddInputVariable(targetRegion, variable);

 

 syscAddSideOneRegion(couplingInterface, sourceRegion);

 syscAddSideTwoRegion(couplingInterface, targetRegion);

 

 syscAddCouplingInterface(couplingInterface);

 

 /\* Heavyweight data access registration. \*/

 syscRegisterSurfMeshAccess(&amp;getSurfaceMesh);

 syscRegisterInputScalarDataAccess(&amp;getInputScalar);

 syscRegisterOutputScalarDataAccess(&amp;getOutputScalar);

 

 printf("Target value before mapping: %f\\n", elemDataTrg[0]);

 

 /\* Inputs update. \*/

 syscUpdateInputs();

 

 printf("Target value after mapping: %f\\n", elemDataTrg[0]);

 

 return 0;

}



If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

// third component with value of 0 can be remove from nodeCoord vector

double nodeCoordsSrc[] = {0, 0, 1, 0, 1, 1, 0, 1};

double nodeCoordsTrg[] = {0, 0, 1, 0, 1, 1, 0, 1};

 

SyscSurfaceMesh getSurfaceMesh(const char* regionName)

{

 if (strcmp(regionName, "source") == 0) {

 //dimension must be supplied with SyscD2 value

 SyscOutputVectorData nodeCoordsData = syscGetOutputVectorDataCompactDoubleDim(

 &amp;nodeCoordsSrc[0], numNodes, SyscD2);

 SyscOutputIntegerData elemNodeCountsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeCountsSrc[0], numElems);

 SyscOutputIntegerData elemNodeIdsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeIdsSrc[0], numElemNodeIds);

 return syscGetSurfaceMeshNCI(

 syscGetNodeDataC(nodeCoordsData),

 syscGetElementNodeCountData(elemNodeCountsData),

 syscGetElementNodeConnectivityData(elemNodeIdsData));

 }

 else {

 SyscOutputVectorData nodeCoordsData = syscGetOutputVectorDataCompactDoubleDim(

 &amp;nodeCoordsTrg[0], numNodes, SyscD2);

 SyscOutputIntegerData elemNodeCountsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeCountsTrg[0], numElems);

 SyscOutputIntegerData elemNodeIdsData = syscGetOutputIntegerDataInt32(

 &amp;elemNodeIdsTrg[0], numElemNodeIds);

 return syscGetSurfaceMeshNCI(

 syscGetNodeDataC(nodeCoordsData),

 syscGetElementNodeCountData(elemNodeCountsData),

 syscGetElementNodeConnectivityData(elemNodeIdsData));

 }

}

//the rest of the code stays unchanged



#### Fortran

program simplemapping

 

implicit none

include 'syscSystemCouplingF.fi'

 

! Mesh and solution data arrays.

real(kind=8), target :: nodecoordssrc(12) = &amp;

 (/ 0d0, 0d0, 0d0, 1d0, 0d0, 0d0, 1d0, 1d0, 0d0, 0d0, 1d0, 0d0 /)

integer(kind=4), target :: elemNodeCountsSrc(1) = 4

integer(kind=4), target :: elemNodeIdsSrc(4) = (/ 1, 2, 3, 4 /)

 

real(kind=8), target :: nodecoordstrg(12) = &amp;

 (/ 0d0, 0d0, 0d0, 1d0, 0d0, 0d0, 1d0, 1d0, 0d0, 0d0, 1d0, 0d0 /)

integer(kind=4), target :: elemNodeCountsTrg(1) = 4

integer(kind=4), target :: elemNodeIdsTrg(4) = (/ 5, 6, 7, 8 /)

 

real(kind=8), target :: elemdatasrc(1) = 33.3d0

real(kind=8), target :: elemdatatrg(1) = 0d0

 

integer(kind=8) :: numNodes = 4

integer(kind=8) :: numElems = 1

integer(kind=8) :: numElemNodeIds = 4

 

type(SyscErrorF) :: ret

type(SyscVariableF) :: variable

type(SyscRegionF) :: sourceRegion

type(SyscRegionF) :: targetRegion

type(SyscCouplingInterfaceF) :: couplingInterface

 

! Setup mapping.

variable = syscgetvariablef(&amp;

 "variable", syscscalar, .true., syscelement)

sourceregion = syscgetregionf("source", syscsurface)

targetregion = syscgetregionf("target", syscsurface)

couplinginterface = syscgetcouplinginterfacef("interface")

 

ret = syscaddoutputvariablef(sourceregion, variable)

ret = syscaddinputvariablef(targetregion, variable)

ret = syscaddsideoneregionf(couplinginterface, sourceregion)

ret = syscaddsidetworegionf(couplinginterface, targetregion)

ret = syscaddcouplinginterfacef(couplinginterface)

 

! Heavyweight data access registration.

ret = syscregistersurfmeshaccessf(getsurfacemesh)

ret = syscregisterinputscalardataaccessf(getinputscalar)

ret = syscregisteroutputscalardataaccessf(getoutputscalar)

 

write(*, *) "Target value before mapping: ", elemdatatrg(1)

 

! Inputs update.

ret = syscupdateinputsf()

 

write(*, *) "Target value after mapping: ", elemdatatrg(1)

 

contains

 

 ! Data access function to get mesh.

 function getsurfacemesh(regionName) result(ret)

 character(len=SyscStrLen), intent(in) :: regionName

 type(SyscOutputVectorDataF) :: nodeCoords

 type(SyscOutputIntegerDataF) :: elemNodeCounts

 type(SyscOutputIntegerDataF) :: elemNodeIds

 type(SyscSurfaceMeshF) :: ret

 if (regionname .eq. "source") then

 nodecoords = syscgetoutputvectordatacompactf(&amp;

 nodecoordssrc, numnodes)

 elemnodecounts = syscgetoutputintegerdataf(&amp;

 elemnodecountssrc, numelems)

 elemnodeids = syscgetoutputintegerdataf(&amp;

 elemnodeidssrc, numelemnodeids)

 else

 nodecoords = syscgetoutputvectordatacompactf(&amp;

 nodecoordstrg, numnodes)

 elemnodecounts = syscgetoutputintegerdataf(&amp;

 elemnodecountstrg, numelems)

 elemnodeids = syscgetoutputintegerdataf(&amp;

 elemnodeidstrg, numelemnodeids)

 endif

 ret = syscgetsurfacemeshf(&amp;

 syscgetnodedataf(nodecoords),&amp;

 syscgetelementnodecountdataf(elemnodecounts),&amp;

 syscgetelementnodeconnectivitydataf(elemnodeids))

 end function getsurfacemesh

 

 ! Data access function to get input scalar data.

 function getinputscalar(regionName, variableName) result(ret)

 character(len=SyscStrLen), intent(in) :: regionName

 character(len=SyscStrLen), intent(in) :: variableName

 type(SyscInputScalarDataF) :: ret

 ret = syscgetinputscalardataf(elemdatatrg, numelems)

 end function getinputscalar

 

 ! Data access function to get output scalar data.

 function getoutputscalar(regionName, variableName) result(ret)

 character(len=SyscStrLen), intent(in) :: regionName

 character(len=SyscStrLen), intent(in) :: variableName

 type(SyscOutputScalarDataF) :: ret

 ret = syscgetoutputscalardataf(elemdatasrc, numelems)

 end function getoutputscalar

 

end program simpleMapping



If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

!third component with value of 0 can be remove from nodeCoord vector

real(kind=8), target :: nodecoordssrc(12) = &amp;

 (/ 0d0, 0d0, 1d0, 0d0, 1d0, 1d0, 0d0, 1d0 /)

real(kind=8), target :: nodecoordstrg(12) = &amp;

 (/ 0d0, 0d0, 1d0, 0d0, 1d0, 1d0, 0d0, 1d0 /)

 

function getsurfacemesh(regionName) result(ret)

 character(len=SyscStrLen), intent(in) :: regionName

 type(SyscOutputVectorDataF) :: nodeCoords

 type(SyscOutputIntegerDataF) :: elemNodeCounts

 type(SyscOutputIntegerDataF) :: elemNodeIds

 type(SyscSurfaceMeshF) :: ret

 if (regionname .eq. "source") then

 !dimension must be supplied with SyscD2 value

 nodecoords = syscgetoutputvectordatacompactdimf(&amp;

 nodecoordssrc, numnodes. syscd2)

 elemnodecounts = syscgetoutputintegerdataf(&amp;

 elemnodecountssrc, numelems)

 elemnodeids = syscgetoutputintegerdataf(&amp;

 elemnodeidssrc, numelemnodeids)

 else

 nodecoords = syscgetoutputvectordatacompactdimf(&amp;

 nodecoordstrg, numnodes, syscd2)

 elemnodecounts = syscgetoutputintegerdataf(&amp;

 elemnodecountstrg, numelems)

 elemnodeids = syscgetoutputintegerdataf(&amp;

 elemnodeidstrg, numelemnodeids)

 endif

 ret = syscgetsurfacemeshf(&amp;

 syscgetnodedataf(nodecoords),&amp;

 syscgetelementnodecountdataf(elemnodecounts),&amp;

 syscgetelementnodeconnectivitydataf(elemnodeids))

end function getsurfacemesh

!the rest of the code stays unchanged



#### Python

from pyExt import SystemCouplingParticipant as sysc

import numpy as np

 

\# Mesh and solution data arrays.

nodeCoordsSrc = np.array(

 [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], dtype = np.float64)

elemNodeCountsSrc = np.array([4], dtype = np.int32)

elemNodeIdsSrc = np.array([1, 2, 3, 4], dtype = np.int32)

 

nodeCoordsTrg = np.array(

 [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], dtype = np.float64)

elemNodeCountsTrg = np.array([4], dtype = np.int32)

elemNodeIdsTrg = np.array([5, 6, 7, 8], dtype = np.int32)

 

elemDataSrc = np.array([33.3], dtype = np.float64)

elemDataTrg = np.array([0], dtype = np.float64)

 

\# Data access function to get mesh.

def getSurfaceMesh(regionName):

 if regionName == "source":

 ncs = [sysc.OutputVectorData](classsysc_1_1OutputVectorData.xhtml)(nodeCoordsSrc)

 encs= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeCountsSrc)

 enis= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeIdsSrc)

 return [sysc.SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(ncs, encs, enis)

 else:

 ncs = [sysc.OutputVectorData](classsysc_1_1OutputVectorData.xhtml)(nodeCoordsTrg)

 encs= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeCountsTrg)

 enis= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeIdsTrg)

 return [sysc.SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(ncs, encs, enis)

 

\# Data access function to get input scalar data.

def getInputScalar(regionName, variableName):

 return [sysc.InputScalarData](classsysc_1_1InputScalarData.xhtml)(elemDataTrg)

 

\# Data access function to get output scalar data.

def getOutputScalar(regionName, variableName):

 return [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemDataSrc)

 

\# Start.

sc = [sysc.SystemCoupling](classsysc_1_1SystemCoupling.xhtml)()

 

\# Setup mapping.

variable = [sysc.Variable](classsysc_1_1Variable.xhtml)("variable", sysc.Scalar, True, sysc.Element)

sourceRegion = [sysc.Region](classsysc_1_1Region.xhtml)("source", sysc.Surface)

targetRegion = [sysc.Region](classsysc_1_1Region.xhtml)("target", sysc.Surface)

couplingInterface = [sysc.CouplingInterface](classsysc_1_1CouplingInterface.xhtml)("interface")

 

sourceRegion.addOutputVariable(variable)

targetRegion.addInputVariable(variable)

couplingInterface.addSideOneRegion(sourceRegion)

couplingInterface.addSideTwoRegion(targetRegion)

sc.addCouplingInterface(couplingInterface)

 

\# Heavyweight data access registration.

sc.registerSurfaceMeshAccess(getSurfaceMesh)

sc.registerInputScalarDataAccess(getInputScalar)

sc.registerOutputScalarDataAccess(getOutputScalar)

 

print(f"Target value before mapping: {elemDataTrg\[0\]}\\n")

 

\# Inputs update.

sc.updateInputs()

 

print(f"Target value after mapping: {elemDataTrg\[0\]}\\n")

[sysc::OutputVectorData](classsysc_1_1OutputVectorData.xhtml)

Provide a class for output vector data.

**Definition** [OutputVectorData.hpp:27](OutputVectorData_8hpp_source.xhtml#l00027)





If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

\#third component with value of 0 can be remove from nodeCoord vector

nodeCoordsSrc = np.array(

 [0, 0, 1, 0, 1, 1, 0, 1], dtype = np.float64)

nodeCoordsTrg = np.array(

 [0, 0, 1, 0, 1, 1, 0, 1], dtype = np.float64)

 

def getSurfaceMesh(regionName):

 if regionName == "source":

 \#when using vector data constructor involving dimension, keyword parameter must be supplied

 \#keyword parameter data and dimension must be supplied with nodeCoordsSrc and sysc.Dimension\_D2 value

 ncs = [sysc.OutputVectorData](classsysc_1_1OutputVectorData.xhtml)(data=nodeCoordsSrc,dimension=sysc.Dimension_D2)

 encs= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeCountsSrc)

 enis= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeIdsSrc)

 return [sysc.SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(ncs, encs, enis)

 else:

 ncs = [sysc.OutputVectorData](classsysc_1_1OutputVectorData.xhtml)(data=nodeCoordsTrg,dimension=sysc.Dimension_D2)

 encs= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeCountsTrg)

 enis= [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(elemNodeIdsTrg)

 return [sysc.SurfaceMesh](classsysc_1_1SurfaceMesh.xhtml)(ncs, encs, enis)

\#the rest of the code stays unchanged



### Volume mapping example

In this example, the solution data is mapped between two volume regions. The mesh in each region consists of a single (unit cube) hexahedral element. The variable to be transferred from source to target is a scalar defined on nodes. The variable is set to be intensive.

The values on the source element are set to `33.3`. Since the meshes are identical on source and target, the expected result of mapping is that the target values also become `33.3`.

Figure 3 illustrates the problem setup.

![](/sites/default/files/migrate-content/system_coupling_cpp_library_2024_r2/SimpleVolumeMappingExample.png "Figure 3: Simple volume mapping example")  
*Figure 3: Simple volume mapping example*

#### C++

\#include "SystemCouplingParticipant/SystemCoupling.hpp"

\#include &lt;vector&gt;

\#include &lt;iostream&gt;

 

// Mesh and solution data arrays.

std::vector&lt;double&gt; nodeCoordsSrc = {

 0, 0, 0,

 1, 0, 0,

 0, 1, 0,

 1, 1, 0,

 0, 0, 1,

 1, 0, 1,

 0, 1, 1,

 1, 1, 1};

 

std::vector&lt;int&gt; cellTypesSrc = {static\_cast&lt;int&gt;(sysc::ElementTypes::Hex8)};

 

std::vector&lt;int&gt; cellNodeIdsSrc = {5, 6, 2, 1, 7, 8, 4, 3};

 

std::vector&lt;double&gt; nodeCoordsTrg = {

 0, 0, 0,

 1, 0, 0,

 0, 1, 0,

 1, 1, 0,

 0, 0, 1,

 1, 0, 1,

 0, 1, 1,

 1, 1, 1};

 

std::vector&lt;int&gt; cellTypesTrg = {static\_cast&lt;int&gt;(sysc::ElementTypes::Hex8)};

 

std::vector&lt;int&gt; cellNodeIdsTrg = {13, 14, 10, 9, 15, 16, 12, 11};

 

std::vector&lt;double&gt; nodalDataSrc(8, 33.3);

std::vector&lt;double&gt; nodalDataTrg(8, 0.0);

 

// Data access function to get mesh.

[sysc::VolumeMesh](classsysc_1_1VolumeMesh.xhtml) getVolumeMesh(const std::string&amp; regionName)

{

 if (regionName == "source") {

 return [sysc::VolumeMesh](classsysc_1_1VolumeMesh.xhtml)(

 [sysc::NodeData](structsysc_1_1NodeData.xhtml)(nodeCoordsSrc),

 [sysc::ElementTypeData](structsysc_1_1ElementTypeData.xhtml)(cellTypesSrc),

 [sysc::ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(cellNodeIdsSrc));

 }

 else {

 return [sysc::VolumeMesh](classsysc_1_1VolumeMesh.xhtml)(

 [sysc::NodeData](structsysc_1_1NodeData.xhtml)(nodeCoordsTrg),

 [sysc::ElementTypeData](structsysc_1_1ElementTypeData.xhtml)(cellTypesTrg),

 [sysc::ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(cellNodeIdsTrg));

 }

}

 

// Data access function to get input scalar data.

[sysc::InputScalarData](classsysc_1_1InputScalarData.xhtml) getInputScalar(

 const std::string&amp; regionName, const std::string&amp; variableName)

{

 return [sysc::InputScalarData](classsysc_1_1InputScalarData.xhtml)(nodalDataTrg);

}

 

// Data access function to get output scalar data.

[sysc::OutputScalarData](classsysc_1_1OutputScalarData.xhtml) getOutputScalar(

 const std::string&amp; regionName, const std::string&amp; variableName)

{

 return [sysc::OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(nodalDataSrc);

}

 

// Main function.

int main(int argc, char* argv[])

{

 // Start.

 [sysc::SystemCoupling](classsysc_1_1SystemCoupling.xhtml) sc;

 

 // Setup mapping.

 [sysc::Variable](classsysc_1_1Variable.xhtml) variable("variable", sysc::Scalar, false, sysc::Node);

 [sysc::Region](classsysc_1_1Region.xhtml) sourceRegion("source", sysc::Volume);

 [sysc::Region](classsysc_1_1Region.xhtml) targetRegion("target", sysc::Volume);

 [sysc::CouplingInterface](classsysc_1_1CouplingInterface.xhtml) couplingInterface("interface");

 

 sourceRegion.addOutputVariable(variable);

 targetRegion.addInputVariable(variable);

 couplingInterface.addSideOneRegion(sourceRegion);

 couplingInterface.addSideTwoRegion(targetRegion);

 sc.[addCouplingInterface](classsysc_1_1SystemCoupling.xhtml#ae4c93f4502c9df950fddddab3aab5eec)(couplingInterface);

 

 // Heavyweight data access registration.

 sc.registerVolumeMeshAccess(&amp;getVolumeMesh);

 sc.[registerInputScalarDataAccess](classsysc_1_1SystemCoupling.xhtml#a60439772708be217b06f07f8554d5abd)(&amp;getInputScalar);

 sc.[registerOutputScalarDataAccess](classsysc_1_1SystemCoupling.xhtml#adeacbc3dfb240c3f389d344337839458)(&amp;getOutputScalar);

 

 std::cout &lt;&lt; "First target value before mapping: " &lt;&lt; nodalDataTrg[0] &lt;&lt; '\\n';

 

 // Inputs update.

 sc.[updateInputs](classsysc_1_1SystemCoupling.xhtml#a9c768f6965f14e8ab3308c7df4144da7)();

 

 std::cout &lt;&lt; "First target value after mapping: " &lt;&lt; nodalDataTrg[0] &lt;&lt; '\\n';

 

 return EXIT_SUCCESS;

}

[sysc::VolumeMesh](classsysc_1_1VolumeMesh.xhtml)

Provide a volume mesh access class.

**Definition** [VolumeMesh.hpp:26](VolumeMesh_8hpp_source.xhtml#l00026)



[sysc::ElementTypeData](structsysc_1_1ElementTypeData.xhtml)

Element types access struct, provides read-only access to the mesh element types.

**Definition** [MeshDefinition.hpp:55](MeshDefinition_8hpp_source.xhtml#l00055)





#### C

\#include "SystemCouplingParticipant/syscSystemCoupling.h"

 

\#include &lt;stdio.h&gt;

\#include &lt;stdlib.h&gt;

\#include &lt;string.h&gt;

 

/\* Mesh and solution data arrays. \*/

double nodeCoordsSrc[] = {

 0, 0, 0,

 1, 0, 0,

 0, 1, 0,

 1, 1, 0,

 0, 0, 1,

 1, 0, 1,

 0, 1, 1,

 1, 1, 1};

 

int cellTypesSrc[] = {SyscHex8};

 

int cellNodeIdsSrc[] = {5, 6, 2, 1, 7, 8, 4, 3};

 

double nodeCoordsTrg[] = {

 0, 0, 0,

 1, 0, 0,

 0, 1, 0,

 1, 1, 0,

 0, 0, 1,

 1, 0, 1,

 0, 1, 1,

 1, 1, 1};

 

int cellTypesTrg[] = {SyscHex8};

 

int cellNodeIdsTrg[] = {13, 14, 10, 9, 15, 16, 12, 11};

 

size\_t numNodes = 8;

size\_t numCellNodeIds = 8;

size\_t numCells = 1;

 

double nodeDataSrc[] = {33.3, 33.3, 33.3, 33.3, 33.3, 33.3, 33.3, 33.3};

double nodeDataTrg[] = {0, 0, 0, 0, 0, 0, 0, 0};

 

/\* Data access function to get mesh. \*/

SyscVolumeMesh getVolumeMesh(const char* regionName)

{

 if (strcmp(regionName, "source") == 0) {

 SyscOutputVectorData nodeCoordsData = syscGetOutputVectorDataCompactDouble(

 &amp;nodeCoordsSrc[0], numNodes);

 SyscOutputIntegerData cellTypesData = syscGetOutputIntegerDataInt32(

 &amp;cellTypesSrc[0], numCells);

 SyscOutputIntegerData cellNodeIdsData = syscGetOutputIntegerDataInt32(

 &amp;cellNodeIdsSrc[0], numCellNodeIds);

 return syscGetVolumeMeshElementBased(

 syscGetNodeDataC(nodeCoordsData),

 syscGetElementTypeData(cellTypesData),

 syscGetElementNodeConnectivityData(cellNodeIdsData));

 }

 else {

 SyscOutputVectorData nodeCoordsData = syscGetOutputVectorDataCompactDouble(

 &amp;nodeCoordsTrg[0], numNodes);

 SyscOutputIntegerData cellTypesData = syscGetOutputIntegerDataInt32(

 &amp;cellTypesTrg[0], numCells);

 SyscOutputIntegerData cellNodeIdsData = syscGetOutputIntegerDataInt32(

 &amp;cellNodeIdsTrg[0], numCellNodeIds);

 return syscGetVolumeMeshElementBased(

 syscGetNodeDataC(nodeCoordsData),

 syscGetElementTypeData(cellTypesData),

 syscGetElementNodeConnectivityData(cellNodeIdsData));

 }

}

 

/\* Data access function to get input scalar data. \*/

SyscInputScalarData getInputScalar(

 const char* regionName, const char* variableName)

{

 return syscGetInputScalarDataDouble(&amp;nodeDataTrg[0], numNodes);

}

 

/\* Data access function to get input scalar data. \*/

SyscOutputScalarData getOutputScalar(

 const char* regionName, const char* variableName)

{

 return syscGetOutputScalarDataDouble(&amp;nodeDataSrc[0], numNodes);

}

 

/\* Main function. \*/

int main(int argc, char* argv[])

{

 /\* Setup mapping. \*/

 SyscVariable variable = syscGetVariableTE("variable", SyscScalar, 0, SyscNode);

 SyscRegion sourceRegion = syscGetRegionT("source", SyscVolume);

 SyscRegion targetRegion = syscGetRegionT("target", SyscVolume);

 SyscCouplingInterface couplingInterface = syscGetCouplingInterface("interface");

 

 syscAddOutputVariable(sourceRegion, variable);

 syscAddInputVariable(targetRegion, variable);

 

 syscAddSideOneRegion(couplingInterface, sourceRegion);

 syscAddSideTwoRegion(couplingInterface, targetRegion);

 

 syscAddCouplingInterface(couplingInterface);

 

 /\* Heavyweight data access registration. \*/

 syscRegisterVolumeMeshAccess(&amp;getVolumeMesh);

 syscRegisterInputScalarDataAccess(&amp;getInputScalar);

 syscRegisterOutputScalarDataAccess(&amp;getOutputScalar);

 

 printf("First target value before mapping: %f\\n", nodeDataTrg[0]);

 

 /\* Inputs update. \*/

 syscUpdateInputs();

 

 printf("First target value after mapping: %f\\n", nodeDataTrg[0]);

 

 return EXIT_SUCCESS;

}



#### Fortran

program simplevolumemapping

 

implicit none

include 'syscSystemCouplingF.fi'

 

! Mesh and solution data arrays.

real(kind=8), target :: nodecoordssrc(24) = (/ &amp;

 0d0, 0d0, 0d0, &amp;

 1d0, 0d0, 0d0, &amp;

 0d0, 1d0, 0d0, &amp;

 1d0, 1d0, 0d0, &amp;

 0d0, 0d0, 1d0, &amp;

 1d0, 0d0, 1d0, &amp;

 0d0, 1d0, 1d0, &amp;

 1d0, 1d0, 1d0 /)

integer(kind=4), target :: cellTypesSrc(1) = syschex8

integer(kind=4), target :: cellNodeIdsSrc(8) = (/ &amp;

 5, 6, 2, 1, 7, 8, 4, 3 /)

 

real(kind=8), target :: nodecoordstrg(24) = (/ &amp;

 0d0, 0d0, 0d0, &amp;

 1d0, 0d0, 0d0, &amp;

 0d0, 1d0, 0d0, &amp;

 1d0, 1d0, 0d0, &amp;

 0d0, 0d0, 1d0, &amp;

 1d0, 0d0, 1d0, &amp;

 0d0, 1d0, 1d0, &amp;

 1d0, 1d0, 1d0 /)

 

integer(kind=4), target :: cellTypesTrg(1) = syschex8

integer(kind=4), target :: cellNodeIdsTrg(8) = (/ &amp;

 13, 14, 10, 9, 15, 16, 12, 11 /)

 

real(kind=8), target :: nodedatasrc(8) = 33.3d0

real(kind=8), target :: nodedatatrg(8) = 0d0

 

integer(kind=8) :: numNodes = 8

integer(kind=8) :: numCellNodeIds = 8

integer(kind=8) :: numCells = 1

 

type(SyscErrorF) :: ret

type(SyscVariableF) :: variable

type(SyscRegionF) :: sourceRegion

type(SyscRegionF) :: targetRegion

type(SyscCouplingInterfaceF) :: couplingInterface

 

! Setup mapping.

variable = syscgetvariablef("variable", syscscalar, .false., syscnode)

sourceregion = syscgetregionf("source", syscvolume)

targetregion = syscgetregionf("target", syscvolume)

couplinginterface = syscgetcouplinginterfacef("interface")

 

ret = syscaddoutputvariablef(sourceregion, variable)

ret = syscaddinputvariablef(targetregion, variable)

ret = syscaddsideoneregionf(couplinginterface, sourceregion)

ret = syscaddsidetworegionf(couplinginterface, targetregion)

ret = syscaddcouplinginterfacef(couplinginterface)

 

! Heavyweight data access registration.

ret = syscregistervolumemeshaccessf(getvolumemesh)

ret = syscregisterinputscalardataaccessf(getinputscalar)

ret = syscregisteroutputscalardataaccessf(getoutputscalar)

 

write(*, *) "First target value before mapping: ", nodedatatrg(1)

 

! Inputs update.

ret = syscupdateinputsf()

 

write(*, *) "First target value after mapping: ", nodedatatrg(1)

 

contains

 

 ! Data access function to get mesh.

 function getvolumemesh(regionName) result(ret)

 character(len=SyscStrLen), intent(in) :: regionName

 type(SyscOutputVectorDataF) :: nodeCoordsData

 type(SyscOutputIntegerDataF) :: cellTypesData

 type(SyscOutputIntegerDataF) :: cellNodeIdsData

 type(SyscVolumeMeshF) :: ret

 if (regionname .eq. "source") then

 nodecoordsdata = syscgetoutputvectordatacompactf(&amp;

 nodecoordssrc, numnodes)

 celltypesdata = syscgetoutputintegerdataf(&amp;

 celltypessrc, numcells)

 cellnodeidsdata = syscgetoutputintegerdataf(&amp;

 cellnodeidssrc, numcellnodeids)

 else

 nodecoordsdata = syscgetoutputvectordatacompactf(&amp;

 nodecoordstrg, numnodes)

 celltypesdata = syscgetoutputintegerdataf(&amp;

 celltypestrg, numcells)

 cellnodeidsdata = syscgetoutputintegerdataf(&amp;

 cellnodeidstrg, numcellnodeids)

 endif

 ret = syscgetvolumemeshf(&amp;

 syscgetnodedataf(nodecoordsdata),&amp;

 syscgetelementtypedataf(celltypesdata),&amp;

 syscgetelementnodeconnectivitydataf(cellnodeidsdata))

 end function getvolumemesh

 

 ! Data access function to get input scalar data.

 function getinputscalar(regionName, variableName) result(ret)

 character(len=SyscStrLen), intent(in) :: regionName

 character(len=SyscStrLen), intent(in) :: variableName

 type(SyscInputScalarDataF) :: ret

 ret = syscgetinputscalardataf(nodedatatrg, numnodes)

 end function getinputscalar

 

 ! Data access function to get output scalar data.

 function getoutputscalar(regionName, variableName) result(ret)

 character(len=SyscStrLen), intent(in) :: regionName

 character(len=SyscStrLen), intent(in) :: variableName

 type(SyscOutputScalarDataF) :: ret

 ret = syscgetoutputscalardataf(nodedatasrc, numnodes)

 end function getoutputscalar

 

end program simpleVolumeMapping



#### Python

from pyExt import SystemCouplingParticipant as sysc

import numpy as np

 

\# Mesh and solution data arrays.

 

nodeCoordsSrc = np.array([

 0, 0, 0,

 1, 0, 0,

 0, 1, 0,

 1, 1, 0,

 0, 0, 1,

 1, 0, 1,

 0, 1, 1,

 1, 1, 1], dtype = np.float64)

 

cellTypesSrc = np.array([sysc.ElementTypes.Hex8], dtype = np.int32)

 

cellNodeIdsSrc = np.array([5, 6, 2, 1, 7, 8, 4, 3], dtype = np.int32)

 

nodeCoordsTrg = np.array([

 0, 0, 0,

 1, 0, 0,

 0, 1, 0,

 1, 1, 0,

 0, 0, 1,

 1, 0, 1,

 0, 1, 1,

 1, 1, 1], dtype = np.float64)

 

cellTypesTrg = np.array([sysc.ElementTypes.Hex8], dtype = np.int32)

 

cellNodeIdsTrg = np.array([

 13, 14, 10, 9, 15, 16, 12, 11], dtype = np.int32)

 

nodalDataSrc = np.array([33.3] * 8, dtype = np.float64)

nodalDataTrg = np.array([0.0] * 8, dtype = np.float64)

 

\# Data access function to get mesh.

def getVolumeMesh(regionName):

 if regionName == "source":

 ncs = [sysc.OutputVectorData](classsysc_1_1OutputVectorData.xhtml)(nodeCoordsSrc)

 cts = [sysc.OutputIntegerData](classsysc_1_1OutputIntegerData.xhtml)(cellTypesSrc)

 cnis= [sysc.OutputIntegerData](classsysc_1_1OutputIntegerData.xhtml)(cellNodeIdsSrc)

 return [sysc.VolumeMesh](classsysc_1_1VolumeMesh.xhtml)(

 [sysc.NodeData](structsysc_1_1NodeData.xhtml)(ncs),

 [sysc.ElementTypeData](structsysc_1_1ElementTypeData.xhtml)(cts),

 [sysc.ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(cnis))

 else:

 ncs = [sysc.OutputVectorData](classsysc_1_1OutputVectorData.xhtml)(nodeCoordsTrg)

 cts = [sysc.OutputIntegerData](classsysc_1_1OutputIntegerData.xhtml)(cellTypesTrg)

 cnis= [sysc.OutputIntegerData](classsysc_1_1OutputIntegerData.xhtml)(cellNodeIdsTrg)

 return [sysc.VolumeMesh](classsysc_1_1VolumeMesh.xhtml)(

 [sysc.NodeData](structsysc_1_1NodeData.xhtml)(ncs),

 [sysc.ElementTypeData](structsysc_1_1ElementTypeData.xhtml)(cts),

 [sysc.ElementNodeConnectivityData](structsysc_1_1ElementNodeConnectivityData.xhtml)(cnis))

 

\# Data access function to get input scalar data.

def getInputScalar(regionName, variableName):

 return [sysc.InputScalarData](classsysc_1_1InputScalarData.xhtml)(nodalDataTrg)

 

\# Data access function to get output scalar data.

def getOutputScalar(regionName, variableName):

 return [sysc.OutputScalarData](classsysc_1_1OutputScalarData.xhtml)(nodalDataSrc)

 

\# Start.

sc = [sysc.SystemCoupling](classsysc_1_1SystemCoupling.xhtml)()

 

\# Setup mapping.

variable = [sysc.Variable](classsysc_1_1Variable.xhtml)("variable", sysc.Scalar, False, sysc.Node)

sourceRegion = [sysc.Region](classsysc_1_1Region.xhtml)("source", sysc.Volume)

targetRegion = [sysc.Region](classsysc_1_1Region.xhtml)("target", sysc.Volume)

couplingInterface = [sysc.CouplingInterface](classsysc_1_1CouplingInterface.xhtml)("interface")

 

sourceRegion.addOutputVariable(variable)

targetRegion.addInputVariable(variable)

couplingInterface.addSideOneRegion(sourceRegion)

couplingInterface.addSideTwoRegion(targetRegion)

sc.addCouplingInterface(couplingInterface)

 

\# Heavyweight data access registration.

sc.registerVolumeMeshAccess(getVolumeMesh)

sc.registerInputScalarDataAccess(getInputScalar)

sc.registerOutputScalarDataAccess(getOutputScalar)

 

print(f"First target value before mapping: {nodalDataTrg\[0\]}")

 

\# Inputs update.

sc.updateInputs()

 

print(f"First target value after mapping: {nodalDataTrg\[0\]}")

[sysc::OutputIntegerData](classsysc_1_1OutputIntegerData.xhtml)

Provide a class for output integer data.

**Definition** [OutputIntegerData.hpp:25](OutputIntegerData_8hpp_source.xhtml#l00025)