|
[Sponsors] |
March 10, 2022, 13:51 |
Reference to portions of a field
|
#1 |
Member
Join Date: Mar 2021
Posts: 39
Rep Power: 5 |
Hello to all,
I would like to know if the following is possible: If I create a tensorField: Code:
volTensorField gradU = fvc::grad(U); tensorField gradU_Internal = gradU.internalField(); Code:
vectorField a = SomeFunctionToSelectTensorField(0,1,2); vectorField b (gradU_Internal.size(), {3,3,3}); a += b; // should change the 0,1,2 entries in the tensorField. Edit: To complement, a C++ example: Code:
#include <vector> #include <iostream> using namespace std; int main(int argc, char** argv) { vector<double> a = {1,2,3,4,5}; vector<std::reference_wrapper<double>> b ={a[0], a[1], a[2]}; vector<double> c = {1,2,3}; for(int i = 0; i < 3; i++) { b[i] += c[i]; } cout << "Done" << endl; return(0); } Last edited by trailer; March 11, 2022 at 05:57. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swakExpression not writing to log | alexfells | OpenFOAM Community Contributions | 3 | March 16, 2020 18:19 |
Domain Reference Pressure and mass flow inlet boundary | AdidaKK | CFX | 75 | August 20, 2018 05:37 |
Sig Density Based Solver installation with FOAM Extend 3.2 | qjh888 | OpenFOAM Bugs | 0 | September 21, 2016 08:16 |
OpenFoam-1.7.x on Suse 11.2 (64bit) does not compile | val46 | OpenFOAM Installation | 4 | August 27, 2010 03:43 |
Error with Wmake | skabilan | OpenFOAM Installation | 3 | July 28, 2009 00:35 |