What data does your calculations need? Can you create a new struct to hold the data you want then:
struct WorkingData
{
//data needed for calculations
}
struct CKTcircuit source = //whatever;
struct WorkingData work;
CKTcircuit_populateWorkingData(source, &work);
calculate(&work);
Alternatively, use a CKTcircuit
for the working data, but be careful to clone structures that contain pointers.
struct CKTcircuit source = //whatever;
struct CKTcircuit work;
CKTcircuit_populateWorkingData(source, &work);
calculate(&work);
But 100 members is not the end of the world:
Might just have to byte the bullet, know the rules and deep clone with an approach like this:
Annotate the members to get an idea of whether each struct is shallow clone OK, or needs deep clone.
struct CKTcircuit
{
int x; //shallow clone OK
int *x2; //pointer - needs deep clone
struct Y y; //shallow clone OK iff members of struct Y are all shallow clone OK
struct Y *y2; //pointer type, needs deep clone
} //conclusion for this stuct - needs deep clone
struct CKTcircuit CKTcircuit_clone(struct CKTcircuit *source)
{
struct CKTcircuit result = *source; //shallow clone
//that has dealt with all value types e.g. ints, floats and
//even structs that aren't pointed to and don't contain pointers
//now need to call similar clones functions on all the pointer types
result.pointerX = &x_clone(source->pointerX);
return result;
}
You may need custom free methods to free memory if something like this does not exist.
void CKTcircuit_free(struct CKTcircuit *source)
{
x_free(source->pointerX);
free(*source);
}